Knowledge

How to use environment variables?

Environment variables are pairs of key-and-value that can be used in Buddy pipelines instead of manually updating the same values across the system on every change. They are most commonly used for authentication credentials, allowing developers to save time looking up and entering access details and eliminating the risk of providing sensitive details in their scripts.

Please mind you need to be an admin to edit environment variables.

Example usage

Let's use the variables to encrypt access to an FTP server:

  1. Go to your deployment pipeline and click the Variables tab
  2. Add variables with the corresponding values. For example:

    • Hostname: FTP_HOST / 192.168.0.100
    • Login: FTP_LOGIN / admin
    • Password: FTP_PASS / buddy1234

    Always choose strong passwords for your credentials. You can also encrypt values so they won’t be presented in plain text.

    If you use SSH, you can store your keys as variables, too.

    Configuring environment variables
    Configuring environment variables
  3. Go back to your pipeline and click the upload action

  4. Enter the variables in the corresponding inputs in the following format: ${VARIABLE}.

    Hostnmame: ${FTP_HOST}
    Login: ${FTP_LOGIN}
    Password: ${FTP_PASS}

    Buddy will automatically suggest the variables once you start typing.

    Using variables in action
    Using variables in action
  5. Click Test connection to see if everything's been configured correctly and save the action.

Hierarchy Tiers

The variables are divided into three tiers:

  1. Workspace (available from DashboardPreferences)
  2. Project (available from Project options)
  3. Pipeline (available from pipeline overview)

Each subsequent tier will overwrite the values from the previous tier.

Workspace environment variables
Workspace environment variables

Use Cases

Supported fields

Here you can check which fields support environment variables and Buddy parameters:

Name Field Variables Parameters
FTP/FTPS Host Yes No
Port Yes No
User Yes No
Pass Yes No
Source Path Yes No
Remote Path Yes Yes
SFTP/Rsync Host Yes No
Port Yes No
User Yes No
Pass Yes No
Passphrase Yes No
Source Path Yes No
Remote Path Yes Yes
SSH Key (N/A in Rsync) Yes No
SSH Commands Yes Yes
Host Yes No
Port Yes No
User Yes No
Pass Yes No
Passphrase Yes No
Working Dir Yes Yes
SSH Key Yes No
HTTP Request URL Yes Yes
Port Yes No
User Yes No
Pass Yes No
Payload Yes Yes
Headers Yes No
Build Docker Image Login Yes No
Password Yes No
Registry Yes No
Repository Yes Yes
Version Yes Yes
Build args Yes Yes
Cloudflare Base URL Yes No
Custom Build Commands Yes Yes
Packages No No
Rackspace Source Path Yes No
Remote Path Yes Yes
DigitalOcean User Yes No
Pass Yes No
URL Yes No
Source Path Yes No
Remote Path Yes Yes
Amazon S3 CloudFrontDistributionId Yes No
Source Path Yes No
Remote Path Yes Yes
Elastic Beanstalk VersionLabel Yes No
Source Path Yes No
CodeDeploy Source Path Yes No
Remote Path Yes Yes
Description
AWS CLI Run commands Yes Yes
Lambda ClientContext Yes Yes
Payload Yes Yes
Qualifier Yes Yes
Lambda Deploy Source Path Yes Yes
Cloudfront Path Yes No
Google Cloud Storage User Yes No
Pass Yes No
URL Yes No
Source Path Yes No
Remote Path Yes Yes
Google Compute Engine User Yes No
Pass Yes No
URL Yes No
Source Path Yes No
Remote Path Yes Yes
Google App Engine Source Path Yes No
Bucket
Version
Image URL
WebDAV User Yes No
Pass Yes No
URL Yes No
Source Path Yes No
Remote Path Yes Yes
Git Push URL Yes No
User Yes No
Pass Yes No
Slack Message Yes Yes
Attachments Yes Yes
SMS Content Yes Yes
Email Title Yes Yes
Content Yes Yes
Pushbullet Title Yes Yes
Content Yes Yes
Link Yes Yes
Pushover Title Yes Yes
Content Yes Yes
Link Yes Yes
Monitoring Actions Destination Yes Yes
Port Yes No
User Yes No
Pass Yes No
Send Yes Yes
Expect Yes Yes
K8s/GKE Authorization (General) Host Yes No
Port Yes No
User Yes No
Password Yes No
API token Yes No
Certificate Yes No
Set K8s/GKE Image Image name Yes Yes
Image tag Yes Yes
Run K8s/GKE Job Image name Yes Yes
Image tag Yes Yes
CMD Yes Yes
Apply K8s/GKE Deployment Config file Yes No
Trigger pipeline Comment Yes Yes
Heroku CLI Run commands Yes Yes
ZIP Source path Yes Yes
Target path Yes Yes
Target file Yes Yes
Newrelic Description Yes Yes
Changelog Yes Yes
Rollbar Environment Yes Yes
Comment Yes Yes
Username Yes Yes
Rollbar Username Yes Yes
Sentry Release version Yes Yes
Deploy environment Yes Yes
Release url Yes Yes
Deploy url Yes Yes
Datadog Event title Yes Yes
Content Yes Yes
Host Yes Yes
Tags Yes Yes
Aggregation key Yes Yes

Get started now

14 days of unlimited trial. No credit card required.