Environment variables

Environment variables are pairs of key and value that can be used to customize the build process and store sensitive data such as access details to deployment servers.


Environment Variables can be defined on 4 levels:

  1. Workspace – available for all projects and pipelines. Configured on the dashboard view.
  2. Project – available for all pipelines in the project. Configured on the project view.
  3. Pipeline – available only for the pipeline in which it was defined. Configured in the Variables tab of the pipeline.
  4. Action – available only for the action in which it was defined. Configured in the Variables tab of the action.

Each subsequent tier will overwrite the value from the higher tier. For example, if you have two the same variables, but one is defined on the workspace level and another on the pipeline level, Buddy will use the pipeline value in that pipeline, and the workspace value in the rest of the workspace.


When adding a new variable, the following fields are available:

  • Scope – defines the level of the variable
  • Name – the name of the variable, e.g. $SFTP
  • Value – the value conveyed by the name, e.g.

Additional options let you hide the value of the variable in the logs, and mark the variable as settable, allowing you to change its value and pass it to the next action or pipeline run.

Example usage

Let's configure some variables to encrypt access to an SFTP server:

  1. Go to the Variables tab in your deployment pipeline.
  2. Add the variables and set your server credentials as values. For example:

    • $SFTP_HOST /
    • $SFTP_LOGIN / admin
    • $SFTP_PASS / buddy1234

Variables in pipelineVariables in pipeline

  1. Now you can use the variables to store access credentials to your deployment server:

Storing credentials to deployment server with variablesStoring credentials to deployment server with variables

Supported fields

Environment variables are supported across the whole service, but most commonly used in the build actions. You can predict a variable by entering $ at the beginning of the supported field:

Run commands boxRun commands box

Here's the list of the currently supported fields:

Action NameSupported Fields
Amazon S3SourcePath, Remote Path, Tag Objects Value
AWS CLIRun Commands
AWS CLI 2Run Commands
AWS ECSSource Path
AWS Lambda DeploySource Path
AWS Lambda TriggerPayload
Azure App ServiceURL, Login, Password
Azure CLIRun Commands
Azure StorageSource Path, Remote Path
Build Android AppRun Commands, Mount Filesystem Path, Mount Container Path, Working dir
Build Android React Native ApplicationRun Commands, Mount Filesystem Path, Mount Container Path, Working dir
Build Docker ImageName, Value
Build Flutter AppRun Commands, Mount Filesystem Path, Mount Container Path, Working dir
Build Ionic appMount Filesystem Path, Mount Container Path, Working dir
BugsnagAPI Key, Version, Revision, Builder Name, Release Stage
CloudFrontBase URL, Source Path
CloudflareBase URL
CodeDeploySource Path, Bucke tName, Description
Compress imagesSource Path, Destination Path
Copy filesSource Path, Remote Path
Custom BuildRun Commands, Mount Filesystem Path, Mount Container Path, Working dir
DatadogEvent Title, Content, Host, Tags, Aggregation Key
Datadog Service CheckHostname, Check
DigitalOcean DropletSource Path, Port, Login, Password, Remote Path, SSH Key Passphrase
DigitalOcean SpacesSourcePath, Remote Path
DigitalOcean Spaces CDNBaseURL
DiscordChannel, Attachments, Message
DockerfileBuild Arguments
Dockerfile LinterDockerfile, YAML file with ignores
Elastic BeanstalkSource, Version, Bucket 1, Environment 2
EmailSubject, Attachments, Message
ESLintMount Filesystem Path, Mount Container Path, Working dir
Find & replaceSource Path, Replacements
FirebaseMount Filesystem Path, Mount Container Path, Working dir
FTPSource Path, Hostname, Port, Login, Password, RemotePath
FTP DownloadHostname, Port, Login, Password, Source Path, Destination Path
FTPSSource Path, Hostname, Port, Login, Password, Remote Path
Function Deploy
GCESource Path, Hostname, Port, Login, Password, Remote Path
GCloud CLIRun Commands
GCSSourcePath, RemotePath
Ghost InspectorPath
Git PushURL, Login, Password
Gitcrypt lock
Gitcrypt unlock
Google App EngineSource Path, Bucket, Version, ImageURL
Google CDNBaseURL
Google Cloud CLIRun Commands
Google Cloud FunctionsSource Path
Google Cloud StorageSource Path, Remote Path
Google Compute EngineSource Path, Hostname, Port, Login, Password, Remote Path
Google Function Trigger
Heroku CLIRun Commands
HTTPEndpointURL, Login, Password, Request headers
Image compressionSource, Destination
Kubernetes ApplyServer, Username, Password, Source Path, Prune Whitelist, Grace Period
Kubernetes CLIServer, Username, Password, Run Commands
Run Kubernetes JobServer, Username, Password, YAML
Run Kubernetes PodServer, Username, Password, YAML
Set Kubernetes ImageServer, Username, Password, ImageName, Image Tag
Lambda DeploySourcePath
Lambda TriggerQualifier
Link checkerURL
Local Shell
MonitoringEnvironment 3, Application 4
MS TeamsChannel email, Title, Attachments from filesystem
New RelicDescription, Changelog, Version
Pass arguments
PHP CodeSnifferMount Filesystem Path, Mount Container Path, Working dir
Publish APK to Google PlayAPK, Main expansion file, Patch expansion file, Service Key, Package name, Mapping file
PushbulletTitle, URL, Message
Push Docker ImageLogin, Password, Repository, Tags
PushoverTitle, URL, URL Title, Message
RackspaceSource Path, Remote Path
RaygunAccess Token, API Key, Version, User, Email, Comment
ReplaceSource Path, Replacements (name)
RollbarEnvironment, Comment, Username, Rollbar Username
RsyncSource Path, Hostname, Port, Login, Password, Remote Path
Run Docker ImageLogin, Password, Image, Version, CMD, Entrypoint
Run Helm CMDsRun Commands, Server, Username, Password
Run next pipelineComment
SentryRelease Version, Deploy Environment, Release URL, Deploy URL, Repository
Sentry On-premisesRelease Version, Deploy Environment, Release URL, Deploy URL, Repository
Sign APKSelect the APK, Location, Keystore Password, Key Alias, Output Directory, Output APK Name
SFTPSourcePath, Hostname, Port, Login, Password, Remote Path, Private SSH Key, SSH Key Passphrase
SFTP DownloadHostname, Port, Login, Password, Source Path, Destination Path, Private SSH Key, SSH Key Passphrase
SlackAttachments, Message
S3 DownloadSource Path, Destination
Split testsTests Path
SSHSource Path, Hostname, Port, Login, Password, RemotePath
SSL verifyWebsite URL
TCPHost, Port, String To Send, String To Expect
Theme Kit CLIRun Commands
TelegramAttachments, Message
UpCloudSource Path, Port, Login, Password, RemotePath, SSH Key Passphrase
Visual tests
VultrSourcePath, Port, Login, Password, Remote Path
Wait for approvalQuestion
WEBURL, Check For String, Login, Password, Request headers
WebDAVSource Path, Hostname, Login, Password
ZIPSource Path, Target Path, File Name

These fields are not available from the front-end. However, the variables do work if the action is added via the REST API or YAML.

Some fields are HTML textareas and do not support variable suggestions – for example, message fields in notifications. They do support ENV VARs perfectly fine, however.

You can also use multi-line environment variables in the listed actions.

If you didn't find your action here or the required field is unsupported, let us know on the live-chat or drop a line at support@buddy.works.

Default environment variables

Buddy populates a number of environment variables during each execution, for example, the branch from which you deploy, and the ID of the execution. You can use them in webhooks, notifications, conditional executions, and any place that require passing CI/CD-related information.

BUDDYRepresents whether the current environment is a Buddy environment
BUDDY_WORKSPACE_URLThe URL of the workspace
BUDDY_WORKSPACE_IDThe ID of the workspace
BUDDY_WORKSPACE_NAMEThe ID of the workspace
BUDDY_WORKSPACE_DOMAINThe slug of the workspace
BUDDY_PROJECT_URLThe URL of the project
BUDDY_PROJECT_NAMEThe name of the project
BUDDY_PROJECT_NAME_IDThe ID of the project
BUDDY_REPO_SLUGThe slug of the repository
BUDDY_REPO_SSH_URLThe SSH URL of the repository
BUDDY_SCM_URLThe URL of the repository synchronized with the project
BUDDY_SCM_PROVIDERThe name of the Git hosting provider synchronized with the project
BUDDY_PIPELINE_URLThe URL of the executed pipeline
BUDDY_PIPELINE_IDThe ID of the executed pipeline
BUDDY_PIPELINE_NAMEThe name of the executed pipeline
BUDDY_PIPELINE_REF_NAMEThe branch/tag/pull request or a wildcard string set in the executed pipeline
BUDDY_PIPELINE_TRIGGER_MODEThe trigger mode set in the executed pipeline
BUDDY_INVOKER_URLThe URL to the profile of the execution invoker
BUDDY_INVOKER_IDThe ID of the execution invoker
BUDDY_INVOKER_NAMEThe name of the execution invoker
BUDDY_INVOKER_EMAILThe email address of the execution invoker
BUDDY_INVOKER_AVATAR_URLThe URL of the avatar of the execution invoker
BUDDY_EXECUTION_URLThe URL of the current execution
BUDDY_EXECUTION_IDThe ID of the current execution
BUDDY_EXECUTION_START_DATEThe date of the current execution
BUDDY_EXECUTION_MODEThe trigger mode used to run the current execution
BUDDY_EXECUTION_CLEAR_CACHERepresents whether the cache was purged before the current execution
BUDDY_EXECUTION_REFRESHRepresents whether the files were uploaded from scratch by the deployment actions in the current execution
BUDDY_EXECUTION_COMMENTThe comment attached to the current execution
BUDDY_EXECUTION_BRANCHThe name of the Git branch of the current execution
BUDDY_EXECUTION_TAGThe name of the Git tag of the current execution (provided the execution is tagged)
BUDDY_EXECUTION_PULL_REQUEST_IDThe ID of the currently executed pull request
BUDDY_EXECUTION_PULL_REQUEST_NOThe number of the currently executed pull request
BUDDY_EXECUTION_PULL_REQUEST_BASE_BRANCHThe name of the Git BASE branch of the currently executed Pull Request
BUDDY_EXECUTION_PULL_REQUEST_HEAD_BRANCHThe name of the Git HEAD branch of the currently executed Pull Request
BUDDY_EXECUTION_PREVIOUS_REVISIONThe SHA1 hash of the commit of the previous execution
BUDDY_EXECUTION_PREVIOUS_REVISION_MESSAGEThe commit message of the previously executed revision
BUDDY_EXECUTION_PREVIOUS_REVISION_SUBJECTThe commit subject of the previously executed revision
BUDDY_EXECUTION_REVISIONThe SHA1 hash of the commit of the current execution
BUDDY_EXECUTION_REVISION_URLThe URL of the commit of the current execution
BUDDY_EXECUTION_REVISION_SHORTThe short hash of the commit of the current execution
BUDDY_EXECUTION_REVISION_MESSAGEThe commit message of the currently executed revision
BUDDY_EXECUTION_REVISION_SUBJECTThe commit subject of the currently executed revision
BUDDY_EXECUTION_REVISION_COMMITTER_EMAILThe email address of the commiter email of the currently executed revision
BUDDY_EXECUTION_REVISION_COMMITTER_NAMEThe email address of the commiter of the currently executed revision
BUDDY_EXECUTION_CHANGELOGThe list of commits pushed since the last executed revision (one commit per line)
BUDDY_EXECUTION_CHANGELOG_ADDEDThe list of files added since the last executed revision (comma-separated)
BUDDY_EXECUTION_CHANGELOG_DELETEDThe list of files deleted since the last executed revision (comma-separated)
BUDDY_EXECUTION_CHANGELOG_CHANGEDThe list of files changed since the last executed revision (comma-separated)
BUDDY_EXECUTION_TIMEThe total time of the current execution until the action is triggered (in seconds)
BUDDY_FAILED_ACTION_LOGSThe logs from the action that has failed in the current execution (one entry per line)
BUDDY_FAILED_ACTION_NAMEThe name of the action that has failed in the current execution
BUDDY_EXECUTION_WARNINGS_COUNTThe total number of warnings that appeared in the current execution
CIRepresents whether the current environment is another CI environment

Exemplary values

BUDDY_PIPELINE_NAME=Deploy to Production
BUDDY_EXECUTION_CHANGELOG=[e5e13f8] Create buddy.yml | mikebenson | 2019-01-01T07:14:58

Combining into phrases

Variables can be combined with other words to create longer phrases than can be used, for example, to automatically name your infrastructure, releases, or sandboxes. However, you need to obey the following rules:

  • Before the variable: any character is allowed.
  • After the variable: letters, numbers, and footers (_) are not allowed.

Correct usage:


Incorrect usage:

release-$BUDDY_EXECUTION_ID_staging (footer)
release-$BUDDY_EXECUTION_IDstaging (letter)
release-$BUDDY_EXECUTION_ID1staging (number)

Passing variables


Passing variables within one pipeline is useful, e.g. when we want to assign file content to a variable and send it in a notification:

Variable passing pipeline exampleVariable passing pipeline example

  1. The first action builds the application and saves the log output to logs.txt.
  2. In case the build fails, the Local Shell action assigns the content of logs.txt to a variable using export LOGS=$(cat log.txt).
  3. The logs are then sent to a Slack channel with $LOGS as the message content.

Make sure to set the variable to Settable, otherwise it will not be possible to change its value.


You can pass the values of variables between executions as well. The values can be saved in one execution and then used in another one, e.g. you can set a variable with the version type and increment it in every execution.


You can pass a variable between pipelines using the Run next pipeline action:

  1. Go into the Variables tab in the action details.
  2. Define the name of the variable and the value to pass: Variables tabVariables tab

You can assign any variable from the target pipeline as the value.


To reset settable variables between pipeline executions, you can add an action with a command that will clear the value of the variable (preferably at the beginning or at the end of the pipeline):

export mySettableEnv=

Reset variable commandReset variable command

On execution start

You can parameterize your execution using the Pass arguments action - it will pause the pipeline and wait for your input to proceed:

Pass arguments windowPass arguments window

Last modified on December 8, 2022

Get Started

Sign up for free and deploy your project in less than 10 minutes.