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.

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

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 (i.e. bitbucket.org or 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_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. 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.

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