Environment variables (or ENV VARs) greatly expand the scope of things that can be achieved with Buddy. Although the most common use case is keeping sensitive configuration data safe and sound (server credentials, passwords, SSH keys, etc.), you can use them, for example, to:
- parameterize pipeline execution
- auto-increment application version
- pass parameters between actions or pipelines
All of the above provide developers with extra control over the delivery process. Additionally, with this week's release it is possible to pass ENV VARs to the execution directly from the terminal using commit commands:
“My message —env MY_VAR=VALUE“$
Values with spaces should be put in a pair of single quotes within the commit message:
“My message —env MY_VAR='VALUE WITH SPACES'“$
ENV VARs in commits are created with the
EXECUTION scope, which means they have higher priority (i.e. overwrite)8 variables with action, pipeline, project, and workspace scopes. Learn more about scopes in variables.
Example use case
Variables in commit messages can be used to trigger pipeline actions on specific conditions. Here we have a pipeline which runs Yarn on repository files, deploys them to Netlify, and notify clients of the new version via Slack. The pipeline is configured to run on every push to the master branch:
However, sometimes we need to release a hotfix which doesn't need informing the client. In this case, we can configure a specific condition in the notification action:
This means the action will always run unless the variable
$SEND_SLACK is set to
NO in the execution. So, if we want to test and deploy the commit without sending the message to the client, all we need to do is add
--env SEND_SLACK=NO to the commit message.
Buddy is 100% customer-driven. If there’s a feature or integration you miss, let us know in the comments below or directly at firstname.lastname@example.org.