6

We're having two builds A and B, where A is an application which depends on library B. Both are Qt projects. Jenkins polls the SCM every 15 minutes. Sometimes it happens that I commit A and B but the timer of A ends before the timer of B. So the Application gets build with an old library, which causes the build to fail. Now I'm looking for a way to tell Jenkins that B has to be built before the build of A starts. However, it's only possible to build something after a successful build.

Is there a simple solution or have we just messed up our build process?

atamanroman
  • 11,607
  • 7
  • 57
  • 81

4 Answers4

3

There is a Parameterized Trigger Plugin, which enables "Trigger/call builds on other projects" in "Add build step" menu.

https://stackoverflow.com/q/5701697/366299

Community
  • 1
  • 1
atamanroman
  • 11,607
  • 7
  • 57
  • 81
2

There are some open bugs in Jenkins related to project references and messed build order. See this bug (or this one). See comments for possible workarounds.

Ludwo
  • 6,043
  • 4
  • 32
  • 48
2

If you switch to Apache Ivy for your dependency management, you can have A triggered, whenever you publish a new version of B (using the Jenkins Ivy Plugin), assuming that A is depending on the latest.integration (or similar) version of B.

This won't stop A from building against an old version of B, but at least it will automatically build again when B is finished.

Also, consider settings up post receive hooks to trigger Jenkins, and adding a quiet period to A. Then when you push changes to A and B, both A and B will be triggered straight away, but A will wait a little while before building. When A's quiet period expires, the Block build when upstream project is building option can be used to force it to wait till B has completed.

Finally, when you've been using Ivy for a while, you'll probably come to the same conclusion as many others: you don't want A depending on latest.integration of B, but a specific version instead. It allows deterministic builds and simplifies the CI job setup (only build A when it's code (which includes the version of B it depends on) changes), but you need to come to that realisation yourself, in your own time.

BTW even though Ivy is very Java focused, I've uses it very successfully on non-java projects; don't be put off.

Dave Bacher
  • 15,652
  • 3
  • 63
  • 86
Tom Howard
  • 6,516
  • 35
  • 58
0

Under Advanced Options in the job A configuration, select Block build when upstream project is building. And make job A depend on job B.

Dave Bacher
  • 15,652
  • 3
  • 63
  • 86
  • 1
    This would stop A from building if B is building, but it wouldn't solve the problem where A it triggered before B. – Tom Howard Nov 24 '11 at 02:21
  • Thanks for the clarification @Tom. I guess I assumed that the timer problem could be solved with a quiet period for A to ensure that B gets triggered. – Dave Bacher Nov 28 '11 at 21:25