DeployHubProject / DeployHub-Pro

DeployHub Pro Pipeline Status Project
https://www.openmakesoftware.com/application-release-automation-for-continuous-delivery/
Other
11 stars 4 forks source link

pass credentials as attribute #321

Closed piyush94 closed 3 years ago

piyush94 commented 3 years ago

Is it possible to pass a credential object values as an attribute for a non-helm deployment? I know the attributes are passed as environment variables to the host.

sbtaylor15 commented 3 years ago

Yes, but you need to have a procedure to convert from a credentials object to a regular variable. This example is getting the credential name from the environment attributes. The attribute dictionary name is 'creds'. The key would be something like 'helm' and the value is the name of the credential object. The getcredential() call is what retrieves the credential from the database. From there you have access to the username and password. The set -g places the myusername and mypassword as global variables so they can be used anywhere in the deployment process.

   set creds = ${environment.attributes['creds']};
   set credname = ${creds['helm']};
   set c = getcredential($credname);

   set -g myusername = ${c.username};
   set -g mypassword = ${c.password}; 
piyush94 commented 3 years ago

@sbtaylor15 Thanks. I'll give this a try.