In order to get the fastest feedback possible, we occasionally want Jenkins jobs to run in Parallel. Jenkins has the ability to start multiple downstream jobs (or 'fork' the pipeline) when a job finishes. However, Jenkins doesn't seem to have any way of making a downstream job only start of all branches of that fork succeed (or 'joining' the fork back together).
Jenkins has a "Build after other projects are built" button, but I interpret that as "start this job when any upstream job finishes" (not "start this job when all upstream jobs succeed").
Here is a visualization of what I'm talking about. Does anyone know if a plugin exists to do what I'm after?
Edit:
When I originally posted this question in 2012, Jason's answer (the Join and Promoted Build plugins) was the best, and the solution I went with.
However, dnozay's answer (The Build Flow plugin) was made popular a year or so after this question, which is a much better answer. For what it's worth, if people ask me this question today, I now recommend that instead.
Best Answer
Pipeline plugin
You can use the Pipeline Plugin (formerly
workflow-plugin
).It comes with many examples, and you can follow this tutorial.
e.g.
Build flow plugin
You can also use the Build Flow Plugin. It is simply awesome - but it is deprecated (development frozen).
Setting up the jobs
Create jobs for:
Setting up the upstream
in the upstream (here
build
) create a unique artifact, e.g.:archive the
build.tag
artifact.build.tag
file and records fingerprints, you will be able to track the parent.promotion
job is successful.Setting up the downstream jobs
PARENT_JOB_NAME
andPARENT_BUILD_NUMBER
Copy the artifacts from upstream
build
job using the Copy Artifact Plugin${PARENT_JOB_NAME}
${PARENT_BUILD_NUMBER}
build.tag
Record fingerprints; that's crucial.
Setting up the downstream promotion job
Do the same as the above, to establish upstream-downstream relationship. It does not need any build step. You can perform additional post-build actions like "hey QA, it's your turn".
Create a build flow job
good luck.