Available Environment Variables

There are a number of environment variables defined during pipeline execution. They contain a variety of information, such as links to the current application, the run, as well as the branch name and the location of your application’s unique cache.

In addition, a number of variables are available to after-steps. See Predefined After Step Variables

Let’s take a look at a selection of the variables available during a build:

Scroll right on the table to reveal cells.

VARIABLE NAME EXAMPLE VALUE PURPOSE/CONTAINS
WERCKER_MAIN_PIPELINE_STARTED 1399372237 Time in milliseconds when the build started
CI true Can be used to detect if the app/script is running in an automated environment
WERCKER_RUN_URL https://app.....178b Link to the build on Wercker
WERCKER_GIT_DOMAIN github.com The domain the repository is cloned from (for example, bitbucket.org, github.com)
WERCKER_GIT_OWNER wercker The owner of the repository
WERCKER_GIT_REPOSITORY step-bundle-install The name of the repository
WERCKER_GIT_BRANCH master The branch name
WERCKER_GIT_COMMIT ef306b2479a7ecd433 7875b4d954a4c8fc18 e237 The commit hash
WERCKER_ROOT /pipeline/build The location of the cloned code
WERCKER_SOURCE_DIR $WERCKER_ROOT/src The path to the directory of the source code. By default WERCKER_ROOT and WERCKER_SOURCE_DIR are the same. However you can change this location via the wercker.yml (to a subfolder in your repository)
WERCKER_CACHE_DIR /cache The path to the cache directory. This directory will be stored after the pipeline completes and restored when the pipeline runs again
WERCKER_OUTPUT_DIR /pipeline/output/ Any files here are assumed to be the result of the build process. If this folder is empty, the WERCKER_ROOT is assumed to contain the build result
WERCKER_REPORT_ARTIFACTS_DIR /report/script-1285a791-a28a-4083-ac4e-ad1ca153fcb5/artifacts This directory is specific to the step being executed. Any files here will be made available to download after the step has completed. This is intended to provide an easy way to get access to test results, screenshots, etc.
WERCKER_STARTED_BY John Doe Run was started by this user
WERCKER_APPLICATION_URL https://app......19ef URL of the application on Wercker

When a step is executed, Wercker also creates additional environment variables for you to use. Please see [the steps section][1] for more information.

The following variables are available during Workflows with a Workflow-type hook. As you can see, it’s more or less an expanded version of the information available during a Git-type hook.

Scroll right on the table to reveal cells.

VARIABLE NAME EXAMPLE VALUE PURPOSE/CONTAINS
WERCKER_MAIN_PIPELINE_STARTED 1399372237 Time in milliseconds when the deploy started
DEPLOY true Shows whether
WERCKER_DEPLOYTARGET_NAME staging Name of the deploy target the deploy is targeting
WERCKER_RUN_URL https://app.....178b Link to the DEPLOY on Wercker
WERCKER_GIT_OWNER wercker The owner of the repository
WERCKER_GIT_REPOSITORY step-bundle-install The name of the repository
WERCKER_GIT_BRANCH master The branch name
WERCKER_GIT_COMMIT ef306b2479a7ecd433 7875b4d954a4c8fc18 e237 The commit hash
WERCKER_ROOT /pipeline/source The location of the build result
WERCKER_SOURCE_DIR /pipeline/source The path to the directory of the source code. By default WERCKER_ROOT and WERCKER_SOURCE_DIR are the same. However you can change this location via the wercker.yml (to a subfolder in your repository)
WERCKER_CACHE_DIR /cache The path to the cache directory. This directory will be stored after the pipeline completes and restored when the pipeline runs again
WERCKER_STARTED_BY John Doe Run was started by this user
WERCKER_APPLICATION_URL https://app......19ef URL of the application on Wercker