Jenkins : Passing a parameter from one job to another

Hey all,

I had this interesting thing to do :-

Requirement: To pass a parameter from one Jenkins job to another(downstream job) & to display this parameter as part of the second job report.

 Solution:After reading few threads on the solution, I inferred that the plugin that would do the job for me was this “Parameterized Trigger Plugin”. –> https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin

Once this plugin is installed , go to Job 1(upstream job) > Post-Build Actions > Select ”Trigger parameterized build on other projects”

The option I chose is given below :-

Screen Shot 2015-02-09 at 4.04.49 pm

I had to send the ‘Build_Number’ of this job to the next. So assigned to a variable ‘Temp’.

In the Downstream Job: To access this parameter use $Temp where you need it. In my case I used in the Editable Email Notification.

There are many other ways of assigning parameters from one job to another using this plugin. You can explore them. This one worked for me like a charm so thought I’d share my 2 cents :).

Regards,

VJ

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s