dstibbe
dstibbe

Reputation: 1697

Jenkins: Wait for multiple project dependencies to finish before building

I have several projects configured in Jenkins which have dependencies on each other (using the 'build after' option). Now I want each project to wait for all its dependencies to finish before they start building.

Example:

Project: A
Project: B - Depencies: A
Project: C - Depencies: A, B

When I build A, then the builds of B and C will be triggered. However, I want C only to build after A and B have finished building. Instead, at the moment project C will build twice, once after A has finished, and a second time after B has finished.

How can I configure Jenkin project dependencies in such a way that I can accomplish this?

Ps.

Before anyone mentions the Join plugin: I have looked at it and can't say it is a satisfying solution.

Upvotes: 6

Views: 6955

Answers (2)

NumberNone
NumberNone

Reputation: 21

You can do that with the DepBuilder plugin and its domain specific language. For your specific example, the build script would like:

// A, B and C are existing Jenkins jobs
A -> B
A -> C
B -> C

After building the project, you should be able to see the build visualization:

DepBuilder plugin build visualization

If any of the upstream projects (A, B) fails to build, the build of job C will not be triggered (but you can configure this behavior for each job separately). For more info about all the possible features, make sure to check the DepBuilder documentation.

Upvotes: 1

Yogesh
Yogesh

Reputation: 4784

You can use JobFanIn plugin. It is exactly what you need

Upvotes: 2

Related Questions