faersons
faersons

Reputation: 615

How to retrieve jenkins build pipeline number?

In Jenkins I would like to build my test environment based on the "Build Pipeline Number" to make tests and deployment repeatable (on the same source version), but I didn't find any environment variable to retrieve this number. I tried to use the BUILD_ID but it is different for each job (downstream project).

Is it possible to retrieve the Build Pipeline Number? Or is there any other control number that I can use that is the same for all the jobs (increases on a new build)?

Upvotes: 3

Views: 1426

Answers (1)

Cole9350
Cole9350

Reputation: 5560

If you are using the less popular Delivery pipeline plugin there is a PIPELINE_VERSION environment variable. Otherwise, with the Build pipeline plugin you would probably have to use your VCS revision number and pass it downstream with Parameterized Trigger Plugin

If you would like to see the list of all current available environment variables just run a batch command SET from your build step (or if linux in shell env)

Upvotes: 2

Related Questions