How to access upstream job variable from downstream job, withhout modifying groovy pipeline script.

94 views
Skip to first unread message

kenzu

unread,
Jan 27, 2021, 12:58:51 PM1/27/21
to Jenkins Users
I have multiple pipelines written in groovy that call a job.
I need to pass the upstream job name to a downstream job, and I'd like to do so without modifying every pipeline by sending the parametized job name environment variable to the job.
I'm trying to find a way to do so from the downstream job itself.
The job has this information, since it knows which job is calling itself.
The Cause object has this information, but the environment variables in each run only show BUILD_CAUSE_UPSTREAMTRIGGER, and BUILD_CAUSE, it does not give me the NAME of the job that triggered it.
I'd like to find a way to add a string parameter to the downstream job so I can pass it to the script that is being executed.Thanks.
Reply all
Reply to author
Forward
0 new messages