Help documentation

Use current revision in a build

It is often useful to use the current version control revision number in your build. For example, you might want to use the svn version number in the name of your binary for tracing purposes. Go makes much of this information available to your build scripts as environment variables.

Example usages

One material

Multiple materials

All Go environment variables

Environment Variable Description Example contents
GO_SERVER_URL Base URL for the Go server (including the context root)
https://127.0.0.1:8154/go
GO_PIPELINE_NAME Name of the current pipeline being run
main
GO_PIPELINE_COUNTER How many times the current pipeline has been run.
2345
GO_PIPELINE_LABEL Label for the current pipeline. By default, this is set to the pipeline count (this can be set to a custom pipeline label)
1.1.2345
GO_STAGE_NAME Name of the current stage being run
dev
GO_STAGE_COUNTER How many times the current stage has been run
1
GO_JOB_NAME Name of the current job being run
linux-firefox
GO_DEPENDENCY_LABEL_${pipeline name}_${stage name} The label of the upstream pipeline (when using dependant pipelines)
1.0.3456
GO_DEPENDENCY_LOCATOR_${pipeline name}_${stage name} The locator of the upstream pipeline (when using dependant pipelines), which can be used to create the URL for RESTful API calls
upstream/1.0.3456/dev/1
GO_REVISION The current source control revision being run (when using only one material)
123
GO_REVISION_ ${material name or dest} If you are using more than one material in your pipeline, the revision for each material is available. The environment variable is named with the material's "materialName" attribute. If "materialName" is not defined, then "dest" directory is used. Non alphanumeric characters are replaced with underscores ("_").
123