6

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.

dstibbe
  • 1,589
  • 18
  • 33
  • This is a problem which Maven (and similar technologies like Ant ivy) is designed to solve. Each build is made independent of each other thru the use of a shared respository of built artifacts. Build servers like Jenkins are able to determine the build order and automatically trigger downstream builds that depend on a particular build's latest artifact. Not a simple answer to your qustion, but something to consider, otherwise you're stuck with the Join plugin :-( – Mark O'Connor Jul 12 '13 at 07:46
  • No, the only way to solve this problem using Maven would be to make them all submodules of one single project. Otherwise Jenkins is not going to sort out the absolute build order.If you configure Jenkins to be triggered by a build of the latest artifact, the problem I described will still occur. – dstibbe Jul 12 '13 at 20:20
  • Checkout the Maven doco. See the "Automatic build chaining.. " section of the Jenkins doco: https://wiki.jenkins-ci.org/display/JENKINS/Building+a+maven2+project Very very useful when dev projects are using snapshot releases of other projects, without this feature, the use of Maven snapshots is highly questionable. A big big plus for using Jenkins. – Mark O'Connor Jul 13 '13 at 07:00
  • Seriously? Formatting a year old post? – dstibbe Nov 11 '14 at 15:41

2 Answers2

2

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

Yogesh
  • 4,546
  • 2
  • 32
  • 41
1

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.

NumberNone
  • 21
  • 2