Suppose i have two multi-branch pipeline jenkins job ABC and XYZ, now i want to start XYZ job automatically while ABC job completed successfully. How can i do it ?
Asked
Active
Viewed 184 times
0
-
Hi @Niladri Dey if this or any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. – Florian Berndl Jan 28 '20 at 11:41
1 Answers
0
If you are using jenkins pipeline
node(){
..
..
..
if (currentBuild.result == "SUCCESS") {
// If wait is set to true you can use the downstream_build.result to define the
//currentBuild.result
def downstream_build = build job: '<path-to>/another-build-job', wait: true
// Here you can set dependency between downstream and current build job
currentBuild.result = downstream_build.result
}
}
If you set wait
to false
your pipeline can immediately finish but you can't use the downstream_build.result
node(){
..
..
..
if (currentBuild.result == "SUCCESS") {
def downstream_build = build job: '<path-to>/another-build-job', wait: false
}
}
Another way is the Trigger Plugin

Florian Berndl
- 1,136
- 8
- 27