Reputation: 1145
In my jenkins pipeline, i trigger a job like this:
stage('Run downstream') {
parallel {
stage('partA') {
steps {
script {
if (env.GIT_BRANCH == 'origin/master') {
build job: 'downstream', wait: true
}
}
}
}
stage('partB') {
steps {
script {
if (env.GIT_BRANCH == 'origin/master') {
build job: 'downstream', wait: true, parameters: [
string(name: 'param', value: 'overriden value')
]
}
}
}
}
}
}
the downstream
job creates an artifact which I'd like to copy to the triggering job. How would I get the build number for each invocation of the job so that I can pull their artifacts?
Upvotes: 1
Views: 1068
Reputation: 1145
I changed:
build job: 'downstream', wait: true
to:
triggeredBuild = build job: 'downstream', wait: true
buildNumber = triggeredBuild.getNumber()
Upvotes: 2