Lieven Cardoen
Lieven Cardoen

Reputation: 25969

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

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.

Upvotes: 11

Views: 21857

Answers (4)

Kumar Pankaj Dubey
Kumar Pankaj Dubey

Reputation: 2327

Just use view name with job name example:-

if your one job in stg and other in a so post-build would be:-

success { build job: "QA/job" }

Upvotes: 0

Russell Gallop
Russell Gallop

Reputation: 1699

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'

Upvotes: 2

EricP
EricP

Reputation: 982

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.

Upvotes: 13

Akhil
Akhil

Reputation: 479

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)

Upvotes: 3

Related Questions