The target job should pre-define variables containing the job name and build number of the Job that causes the build.
- Upstream #3 promotes Downstream
- Then in Downstream I have JENKINS_PROMOTING_JOB_NAME="Upstream" and JENKINS_PROMOTING_BUILD_NUMBER="3" defined
This is useful where the downstream promotion should copy artifacts from the upstream project. The upstream's job name can be manually configured for the downstream job, but this is not possible when multiple upstream jobs should be able to trigger one downstream job.
Currently I workaround this using the Jenkins CLI within a shell excecuting promotion where I trigger parameterized builds. But this is times slower than a "execute shell" promotion.