I have two jobs(A and B) that I want to B is triggered by A with the git commit used by A after A is successfully built.
The build trigger plug-in supports trigger the downstream job with the git commit used in the upstream job.
My question is how the downstream job uses the passed in commit to check out. I didn't find which variable is passed by job A, and how to use the pass-in commit value to check out code in B via Git plug-in of Jenkins?
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.
An upstream project is one in which a job is triggered before the actual project is triggered. Whereas, Downstream project is one in which a job is triggered after the project has been triggered.
You can probably find the last build number with groovy in regards to your upstream build, increment it, and assign that value to a dynamic parameter. That means it would be a number generated at build-queue and as long as it's forwarded downstream, should remain the same when needing to reference it.
Jenkins Git plug-in is an intelligent tool. No specific configuration is needed. In upstream job trigger the downstream job with the Git commit used by the upstream job, downstream will automatically checkout the commit passed in by upstream.
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