The Jenkins Join Plugin allows a job to be run after all the immediate downstream jobs have completed.
But how can I configure a job to be run after all downstream jobs have completed, not only the immediate ones?
This figure shows the jobs triggering flow I expect:
A
|
--+----+------+--
| |
v v
B C
| |
--+--------+-----+---+-- |
| | | |
v v v |
D E F |
| | | |
v | | |
G | | |
| | | |
---+--------+----+----+-------+--
|
v
J
I set Join Trigger on job A to trigger the final job J. However job J is started once B and C are finished, does not wait for jobs D,E,F and G.
In this answer and its comments, it said that the paths can be multiple jobs deep and fingerprints must be correctly used. But I can't figure out how to make it work.
An upstream job is a configured project that triggers a project as part of its execution. A downstream job is a configured project that is triggered as part of a execution of pipeline.
You can follow the below steps to trigger a Jenkins pipeline in another Jenkins pipeline. Select a job that triggers a remote one and then go to Job Configuration > Build section > Add Build Step > Trigger builds on remote/local projects option.
Use build job plugin for that task in order to trigger other jobs from jenkins file. You can add variety of logic to your execution such as parallel ,node and agents options and steps for triggering external jobs.
In case someone is looking for easy way just use JobFanIn plugin. This plugin will allow you to set trigger on job J once C, E, F & G are build and stable
The Join plugin works only when everything is broken up into "diamonds" of dependencies: a single starting job, one or more downstream jobs, but only one level deep (D and G are two levels deep in your diagram), followed by a single joined job. Your dependency structure doesn't follow that diamond pattern.
For this particular situation, I would use the Promoted Builds Plugin. Setup Job A to have a promotion that when triggered, runs Job J. Make the trigger for that promotion be the successful completion of B, C, D, E, F, G. Or if want to minimize it: G, E F, C. Just make sure that fingerprinting is setup correctly.
For the fingerprinting, generate a file (or choose an existing file) during Job A. Artifact it and fingerprint it. In all the following jobs B-G, use the CopyArtifact plugin to retrieve that file into the job and fingerprint it there as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With