Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build a Jenkins project only when two other projects have successfully been built?

Tags:

jenkins

I've figured out how to trigger another Jenkins project build after a successful build, but how do you solve next situation:

Project A triggers project B and C. Project D should only be build if project B and C have successfully been built. I can't configure B to trigger project D because I'm not sure project C has been built yet, and vice versa.

like image 526
Lieven Cardoen Avatar asked Sep 18 '14 12:09

Lieven Cardoen


3 Answers

The "build after other projects are built" suggested by Akhil will not accomplish the stated goal. It will trigger Project D after either Project B or Project C is built. Use the Join Plugin.

like image 70
EricP Avatar answered Oct 19 '22 20:10

EricP


There is an option in "Build Triggers" option to "Build after other projects are built". Here is the snapshot for the same:

enter image description here

In the Projects to watch, mention: Project B, Project C(Note that multiple projects are mentioned with a comma separated value)

like image 23
Akhil Avatar answered Oct 19 '22 19:10

Akhil


Alternatively you can orchestrate this with a Pipeline job. For example you could have another job doing this (or you could make job A into a pipeline job and skip the first build step)

build 'A'

parallel(firstTask: {
    build 'B'
}, secondTask: {
    build 'C'
})

build 'D'
like image 30
Russell Gallop Avatar answered Oct 19 '22 20:10

Russell Gallop