Skip to main content

Available environment variables

Environment Variables (Env Vars) consist of a key and a value. They can also include optional attributes. They can be defined on the level of apps, Workflows or Steps.

You can set your own Env Vars but there is a selection of Env Vars that are exposed automatically by either the Bitrise CLI or bitrise.io.

In addition, plenty of Bitrise Steps export output variables. These variables are available to subsequent Steps during a build. You can find them in the Step configuration of each Step:

  • In the Workflow Editor, you can check them in the Output properties section of a Step.
  • In the step.yml of a Step, you can find them under outputs.

Release Management also passes a number of Env Vars to Bitrise builds: Release Management Env Vars.

Environment Variables have a set availability order. This is the order in which they are made available as a build progresses: Availability order of Environment Variables.

Step outputs exposed as Env Vars

Steps can also expose Step outputs as Env Vars. For example, a Step that builds a binary can expose that binary to other Steps as an Env Var. As basically any Bitrise Step can expose outputs this way, we won't list them all but you can find all Environment Variables related to the git cloning process: Git clone Env Vars.

Env Vars exposed by the Bitrise CLIClick to copy link

Env VarDescription
$BITRISE_TRIGGERED_WORKFLOW_IDThe ID of the Workflow that was triggered. This Env Var is exposed regardless of whether the Workflow was triggered manually or automatically.
$BITRISE_TRIGGERED_WORKFLOW_TITLEThe title of the Workflow that was triggered. This Env Var is exposed regardless of whether the Workflow was triggered manually or automatically.
$BITRISE_BUILD_STATUSThe current status of the build. The available options are: - 0: Successful. - 1: Failed. A successful current status means that none of the previous Steps in the build failed.
$BITRISE_SOURCE_DIRPath to the base working directory. By default, it’s the directory where Bitrise runs, unless you provide a different value. This can be overwritten during the build, which will change the working directory for subsequent Steps in the build.
$BITRISE_DEPLOY_DIRPath to the directory that stores artifacts and files for deployment. It’s a temporary directory created by the Bitrise CLI by default, and can be overwritten before starting the Bitrise CLI. The Deploy to Bitrise.io - Build Artifacts, Test Reports, and Pipeline intermediate files Step looks for your build artifacts - such as an IPA or APK of the app -, test results, and other files in this directory.
$BITRISE_TEST_DEPLOY_DIRRoot directory for all test results created by the Bitrise CLI. Test results placed in this directory can be viewed alongside all other test results: Deploying and viewing test results.
$BITRISE_TEST_RESULT_DIREach Step has its own value of this variable. It provides a unique subdirectory, under $BITRISE_TEST_DEPLOY_DIR for each Step to save its test results.
$BITRISE_FAILED_STEP_TITLEThe title of the Step that first fails in a build. In other words, the Step that sets the build status to Failed.
$BITRISE_FAILED_STEP_ERROR_MESSAGEThe error message of the Step that first fails in a build.
$CIIndicates whether the Bitrise CLI is running in Continuous Integration mode. The possible values are: - true - false
$PRIndicates whether the Bitrise CLI is running in PR (Pull Request) mode. Running in Pull Request mode means that Bitrise builds your code in the state as if the Pull Request was already merged. The possible values are: - true - false

Env Vars exposed by bitrise.ioClick to copy link

Env VarDescription
$BITRISE_BUILD_NUMBERBuild number of the build on bitrise.io.
$BITRISE_APP_TITLEThe title of your project on bitrise.io. You can change it any time on the Project settings page of the project.
$BITRISE_APP_URLThe URL or your project on bitrise.io. This is not the same as the Git repository URL! A project URL has the following format: app.bitrise.io/APP-SLUG/ For example: https://app.bitrise.io/app/31e481ce08e0xfd9.
$BITRISE_APP_SLUGThe slug that uniquely identifies your project on bitrise.io. It’s part of the project URL, too.
$BITRISE_BUILD_URLThe URL of the build on bitrise.io.
$BITRISE_BUILD_SLUGThe slug that uniquely identifies a build on bitrise.io. It’s part of the build URL, too. For example, let’s take a look at this build URL: https://app.bitrise.io/build/d75abbebxfc9ca4e. The build slug is d65abbebxfc9ca4e in this example.
$BITRISE_BUILD_TRIGGER_TIMESTAMPThe date and time when the build was triggered.
$GIT_REPOSITORY_URLThe URL of the Git repository that hosts your project. This can be changed in the Settings tab of the app. It can be in either SSH or HTTPS format.
$BITRISE_GIT_BRANCHThe git branch that is built by Bitrise. For example, main.
$BITRISEIO_GIT_BRANCH_DESTUsed only with builds triggered by pull requests: the destination/target branch of the pull request that triggered the build. For example, a pull request wants to merge the content of a branch into the branch main. In this case, this Env Var’s value is main.
$BITRISE_GIT_TAGIf a build is triggered by a Git Tag, this Env Var stores the tag used.
$BITRISE_GIT_COMMITThe commit hash of the Git commit that triggered the build, when applicable.
$BITRISE_GIT_MESSAGEThe commit message, pull request title, or the message you specified if you triggered the build manually.
$BITRISEIO_GIT_REPOSITORY_OWNERThe owner of the Git repository of the project.
$BITRISEIO_GIT_REPOSITORY_SLUGThe slug of the Git repository of the project.
$BITRISE_PULL_REQUESTThe ID of the pull request that triggered a build.
$BITRISEIO_PULL_REQUEST_REPOSITORY_URLThe URL of the repository from where the pull request that triggered a build has been sent.
$BITRISEIO_PULL_REQUEST_MERGE_BRANCHThe pre-merge branch - if the Git hosting provider supports and provides the pre-merged state of a pull request on a special merge branch.
$BITRISEIO_PULL_REQUEST_HEAD_BRANCHThe pull request head branch, if the Git hosting provider system supports and provides this. This special git ref should point to the source of the pull request.
$GITHUB_PR_IS_DRAFTFor projects hosted on GitHub only: it is set to true if the build is triggered by a draft pull request.
$BITRISE_PROVISION_URLThe URL of the Apple provisioning profiles uploaded to bitrise.io. If there is more than one provisioning profile uploaded for your project, a pipe character (`
$BITRISE_CERTIFICATE_URLThe URL of the Apple certificates uploaded to bitrise.io. If there is more than one certificate uploaded for your project, a pipe character (`
$BITRISE_CERTIFICATE_PASSPHRASEThe passphrase you set for the uploaded Apple certificates on the project’s Code Signing & Files tab. If there is more than one certificate with a passphrase, a pipe character (`
$BITRISE_IOIndicates that the build is running in a bitrise.io environment. Value is set to true by Bitrise when it starts a build.
$BITRISE_TRIGGER_BYIdentifies the entity that triggered the build. The value can be: - The Git user's name when the build is triggered by a Git provider. - The Bitrise user's name if the build is triggered manually from the Bitrise web UI. - The value specified in the triggered_by build parameter if the build is triggered any other way (such as scheduled builds or builds triggered by the API).
$BITRISE_TRIGGER_METHODThe method by which the build was triggered. - schedule: When the build is triggered by a scheduler. - webhook: When the build is triggered automatically by a webhook at a Git provider. - manual: When the build is triggered by any other trigger, including the API.
$BITRISE_GIT_PULL_REQUEST_COMMENTThe comment message and its corresponding ID from a pull request (or merge request in the case of GitLab). Only available when the build is triggered by a PR comment: the build trigger must have a pr_comment value.
$BITRISE_GIT_PULL_REQUEST_COMMENT_IDThe comment ID from a pull request. Only available when the build is triggered by a PR comment.
$BITRISE_GIT_PULL_REQUEST_LABELSA multiline list of new labels added to the pull request along with existing labels. Only available when the build is triggered by adding a label to a pull request or by a PR event with existing labels. Only supported for GitHub and GitLab.
$BITRISE_GIT_CHANGED_FILESLists file paths changed by a code push or pull request. Contains max 3000 files per event. It's available when: - A push event triggers a build. Only supported for GitHub and GitLab. - A PR event triggers a build and the trigger has a changed_files or commit_message condition. Supported for all three main Git providers. Note: this env var can become really large in some builds. If you build custom scripts that parse this env var, please see the env var size limitations section below.
$BITRISE_GIT_COMMIT_MESSAGESThe commit messages of a code push or pull request. Contains max the first 2048 commits, and at most 1000 characters in each message. It's available when: - A push event triggers the build. Only supported for GitHub and GitLab. - A PR event triggers a build and the trigger has a commit_message condition. Supported for all three main Git providers. Note: this env var can become really large in some builds. If you build custom scripts that parse this env var, please see the env var size limitations section below.
$BITRISE_WORKSPACE_IDThe workspace slug of the workspace that owns the project.
Env Var size limitations

Some of the above environment variables can become really large in some builds (for example, if a git commit has a really long commit message or a pull request modifies thousands of files). If the total size of all env vars would hit OS limits, Bitrise removes some env vars from the runtime environment and writes the full value to a file on disk.

If you have custom scripts that rely on env vars that could grow large in some builds, you should read the value from this env file instead. The env var is located at $BITRISEIO_ENVFILE_PATH on both macOS and Linux stacks. It has the following format:

envs:
# Every env var from the build trigger and git event.
BITRISE_GIT_CHANGED_FILES: ...
BITRISE_GIT_COMMIT_MESSAGES: ...
CI: true
PR: true
[...]

# List of env var KEYS that had to be erased. You should read the original value from the map above, this is just for debugging.
erased_envs:
- BITRISE_GIT_CHANGED_FILES

Pipeline Env Vars exposed by bitrise.ioClick to copy link

Env VarDescription
$BITRISEIO_PIPELINE_IDThe ID of the running Pipeline build. This Env Var is exposed regardless of whether the Pipeline was triggered manually or automatically.
$BITRISEIO_PIPELINE_TITLEThe name of the running Pipeline build. This Env Var is exposed regardless of whether the Pipeline was triggered manually or automatically.
$BITRISEIO_FINISHED_STAGESThe status of previously finished Stages and Workflows in a build. Please note that the value of this Env Var may change in the future!
$BITRISEIO_PIPELINE_BUILD_STATUSThe current status of the Pipeline build. The value of this Env Var can be: succeeded, succeeded_with_abort, failed, and aborted. While the Pipeline is running, the Env Var's status is based on the previously finished Stages.
$BITRISEIO_PIPELINE_BUILD_URLThe URL of the Pipeline build.

Release Management Env VarsClick to copy link

Env VarDescription
$RM_RELEASE_IDThe unique identifier of your release on bitrise.io. It’s part of the release URLs, too.
$RM_RELEASE_VERSIONThe release name (for Google Play releases) or version (for App Store releases) in Release Management.
$RM_RELEASE_CANDIDATE_VERSIONThe version of the binary (APK/AAB or IPA file) generated by the release candidate build.
$RM_RELEASE_CANDIDATE_DOWNLOAD_URLThe download URL of the binary (APK/AAB or IPA file) generated by the release candidate build.
$RM_RELEASE_CANDIDATE_SLUGUnique identifier of the binary (APK/AAB or IPA file) generated by the release candidate build.
$RM_RELEASE_CANDIDATE_BUILD_SLUGThe build slug of the build that was selected as a release candidate for the release.
$RM_CONNECTED_APP_IDThe unique identifier of your connected app on bitrise.io.
$RM_PROJECT_IDThe unique identifier of your project on bitrise.io. It’s part of the project URL, too.
$RM_WORKSPACE_IDThe unique identifier of your workspace on bitrise.io.
$RM_EVENT_IDIdentifies the trigger which starts the Bitrise CI workflows. See the list of events and their IDs on the Configuring release automation page.

Git clone Env VarsClick to copy link

Env VarDescription
$GIT_CLONE_COMMIT_HASHThe hash of the commit that the build uses (the cloned commit).
$GIT_CLONE_COMMIT_MESSAGE_SUBJECTThe subject of the commit message of the cloned commit.
$GIT_CLONE_COMMIT_MESSAGE_BODYThe body (content) of the commit message of the cloned commit.
$GIT_CLONE_COMMIT_COUNTThe commit count of the cloned commit. This Env Var is influenced by the clone_depth Step input. For more information, check out the Git Clone Step description.
$GIT_CLONE_COMMIT_AUTHOR_NAMEThe name of the author of the cloned commit.
$GIT_CLONE_COMMIT_AUTHOR_EMAILThe email of the author of the cloned commit.
$GIT_CLONE_COMMIT_COMMITER_NAMEThe name of the committer of the cloned commit.
$GIT_CLONE_COMMIT_COMMITER_EMAILThe email of the committer of the cloned commit.