3

I have a series of Hudson jobs I want to run to test out various builds:

  1. Build 1.17 on Server X
  2. Build Trunk on Server X
  3. Test1
  4. Test2

I want to do run these jobs in series with each job waiting for the other to finish: Build 1.17, Test1, Test2, Build Trunk, Test1, Test2

On the other hand, I have two other jobs Test3 and Test4, which can be run in parallel, and just after Build Trunk.

I'd prefer not to have to chain multiple jobs together from the post-build-steps section of each job, but this is the only way I can make them run in series. The problems with this are: 1) Job Duplication: I need 2 copies of Test1 and Test2: Build 1.17-> Test1 -> Test2 -> Build Trunk -> Test1 (copy for trunk) -> Test2 (copy for trunk). 2) More Duplication: I need another Build Trunk so I don't run Test1 every time I want to run Test3 and Test4.

Is there a simple way to have jobs operate in series without modifying the individual jobs and creating dependencies between them outside of a top-level job?

Is such a thing even possible

UPDATE: Eventually what we did is use Rakefiles to manage the whole process. None of the plugins were robust enough for this. A hudson job calls a Rakefile with args which calls other hudson jobs.

Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
nflacco
  • 4,972
  • 8
  • 45
  • 78

2 Answers2

3

Have a look at the Locks and Latches plugin - this lets you set up more complex build dependencies without having to duplicate your jobs.

gareth_bowles
  • 20,760
  • 5
  • 52
  • 82
  • Works fine. I set up a custom lock in the manage hudson/configure menu. One thing to note is that jobs will start in parallel even with a lock, but they will just hang until the lock is released, so everything works fine even if it doesn't look like it from the main hudson/jenkins screen. – nflacco Oct 12 '11 at 23:21
  • Hmmm, so I set up the full run, and it the locks work, but jobs don't happen in order, and jobs are not repeated. So if I run Build 1.17, Test, Build 1.18, Test, the jobs don't run at the same time, but... execution order is arbitrary, and the Test job doesn't run twice :*( – nflacco Oct 13 '11 at 01:16
2

Have a look at the (relatively new) Multijob Plugin. You can then define multiple phases that get executed in series, with all jobs within a phase running in parallel. For your example, set up 6 phases. Phase 1 running Build 1.17, phase 2 running Test 1, etc. In phase 5 (after Build Trunk), you can run Test 3 and Test 4 in parallel.

Alternatively, build two separate pipelines with the Build Pipeline Plugin to start each pipeline manually.

BTW, the Locks and Latches plugin is deprecated, superseded by the Throttle Concurrent Builds Plugin. This works as a charm to avoid for instance running Test 3 and Test 4 jobs together on the same slave (and overload the slave).

Martijn Rutten
  • 763
  • 6
  • 14
  • Actually, some guys at work came up with an internal tool that allows us to manage jobs in series and parellel via rake tasks. It works very reliably and is considerably better than doing stuff in hudson proper. – nflacco Feb 05 '12 at 07:30