0
votes

I have two jobs which are pipeline, I want to send the Parameter (Branch name) info of upstream job to downstream.

The main point is we shouldn't build upstream project before passing parameter to Downstream job.

Whenever I trigger the downstream job it need to get the Branch name parameter from the upstream job

How can I do this?

1

1 Answers

0
votes

Passing parameters from jobs to jobs within pipelines is very hard to maintain, I won't recommend it. At first it seems logic but it's the old way of thinking with Jenkins and it leads to Frankenstein pipelines.

Learn how shared libraries work. It looks scary at first but it's simple. The files in the folder vars/ define the custom steps you can trigger. In src/ folder you put your code logic.

If you need several jobs, just create several jobs and reuse the code you wrote in the pipeline but try not to call jobs from jobs.

I know it's not the answer you were expecting but hopefully by listening to my comment you will get happier times :)