Reputation: 165
Is there an environment variable that captures the downstream job's build number ? I am using build step in pipeline as code.
Upvotes: 3
Views: 1396
Reputation: 4511
Not an environment variable, but an object property:
downstreamBuild = build 'myDownstreamJob'
downstreamBuildNumber = downstreamBuild.rawBuild.id
Note that you will either need to disable the Groovy sandbox or get script approvals in order to use rawBuild
. Also, you cannot use wait: false
with your build step, since build()
returns null
when called with wait: false
.
Upvotes: 3