2

So this is a similar question: Triggering upstream project builds before downstream project

But I don't want the all-or-nothing behavior that guy is asking for, I just want hudson to build the projects in the right order so we don't get false alarm failed builds.

We have two projects, one depending on the other. If we do a simultaneous checkin to both projects (where the dependent project will fail without the dependency being built first), Hudson seems to pick one at random, so sometimes we get a failed build, then the other project builds successfully, then the retry on the other project succeeds.

Hudson is smart enough to figure out from the maven pom's what is upstream and downstream, and even knows to build the downstream stuff when the upstream changes, but it doesn't know to build the upstream stuff before the downstream stuff if they've both changed.

Is there a configuration setting I'm missing? "Build after other projects are built" appears to just be a manual version of what it will already do for upstream projects.

Community
  • 1
  • 1
Brian Deacon
  • 21,384
  • 13
  • 39
  • 41
  • Possible duplicate of: http://stackoverflow.com/questions/4022354/how-to-delay-a-hudson-build-until-its-dependencies-are-built – Dave Bacher Dec 20 '10 at 18:32

3 Answers3

2

Under Advanced Project Options you have the quiet period. Set for your first build the quiet period to 5 seconds and for the second to 2 minutes. This should do the trick. You can also try with 5 and 10 seconds, I just choose 5 and 120 since Hudson will check for changes not more often than every minute. I don't know how the svn check is implemented. So 2 minutes will ensure that your first project will at least be checked once before the second build starts. (assumption: both jobs check every minute for SVN changes)

You also need to make sure that both jobs are not running at the same time. So I would use Block build when upstream project is building (also advanced options) to ensure that they build not at the same time. You can also try only this option first, may be this option is already good enough.

Dave Bacher
  • 15,652
  • 3
  • 63
  • 86
Peter Schuetze
  • 16,185
  • 4
  • 44
  • 58
0

If both projects belong to the same maven parent project, then you need only one hudson job for this maven parent project. -- And you don't need any up- or downstream dependencies.

Ralph
  • 118,862
  • 56
  • 287
  • 383
0

I am facing the same issue. Unfortunately it seems to be a known bug that the Block build when upstream project is building option does not work when the hudson server is configured with multiple executors/nodes.

http://issues.hudson-ci.org/browse/HUDSON-5125

A workaround could be using the Naginator Plugin which can reschedule a build after a build failure.

Jcs
  • 13,279
  • 5
  • 53
  • 70