We have a five step build process:

1. Build & Unit-Test
2. Container-Test
3. Package for deployment
4. Deploy to functional test environment
5. Deploy to integration test environment

Steps 2 & 3 are triggered by a finish build trigger on step 1. Step 4 is triggered by a finish build trigger on step 3, and uses the artifacts generated in 3. Step 5 is manual.

Steps 1 through 3 are maven builds performed on a clean checkout of the head from subversion. Herein lies the problem. If a developer commits during step 1, then steps 2 and 3 will be run against a different revision than step 1. With really bad timing it is possible for steps 1 through 3 to run on different revisions.

Is there a way to carry the revision number from step 1 through the other steps?


1 Answers


It turns out that the answer is to add a snapshot dependency on step 1, with the options:

Do not run new build if there is a suitable one
Only use successful builds from suitable ones

The finish build trigger is still needed to make steps 2 and 3 run automatically. One consequence of this is that if I choose to run, say, step 3, manually, after a commit, step 1 will be run first.