Environment variables are the defacto way to retrieve information on wercker. Wercker provides a lot of information by default that we can use in our steps.
So let’s look at a couple of them that you can leverage, apart from those made available through services as mentioned above.
|VARIABLE NAME||EXAMPLE VALUE||PURPOSE|
|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_SOURCE_DIR||$WERCKER_ROOT/src||The path to the directory of the source code|
|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_STEP_ROOT||/wercker/steps/wercker /bundle-install/0.9.1||The path to the working directory of the step that is currently executed. It contains the full content as deployed to the wercker directory|
|WERCKER_STEP_ID||9c182f44-e12d-4daf-91eb-a48d0540cc10||The unique idenfier for the step, unique for each build/deploy.|
|WERCKER_STEP_NAME||bundle-install||The name of the step as specified by the step inwercker-step.yml|
|WERCKER_REPORT_MESSAGE_FILE||$WERCKER_REPORT_DIR/ $WERCKER_STEP_ID/ message.txt||The location of a file you can use to output additonal information about the step.|
Environment variables are made available in the different steps that get executed in the wercker pipeline. For more information on how variables are made available and handled on the wercker platform, have a look on our devcenter.
Earn some stickers!
Let us know about the applications you build with wercker. Don’t forget to tweet out a screenshot of your first green build with #wercker and we’ll send you some @wercker stickers.
Follow us on twitter as well to stay in the loop.