Reputation: 627
I'm using Jenkins for testing/build purposes, so I created a MultiJob project with this configuration:
The MultiJob is launched from the Master Jenkins, but other jobs are launched from other Nodes. The Build Job executes a shell script which creates the BUILD_ID. Now, I want the BUILD_ID to be passed as parameter to the Install Job. How can I do that? My only choice is to use a property file?
Thanks a lot
Upvotes: 10
Views: 23751
Reputation: 715
You can pass the parameter BUILD_ID
by using Predefined parameters option in the multi-job phase.
Steps are as follows:
BUILD_ID
to it;Upvotes: 6
Reputation: 177
The question asks how to pass values between jobs for MultiJob projects, not Parameterized Trigger. Parameterized Trigger might not be a good solution because the downstream job will be executed outside of the scope of the MultiJob parent. To pass variables between MultiJob sub-jobs,
Upvotes: 12
Reputation: 8107
To use the suggestion i am going to describe, you will need Parameterized Trigger plugin. One way to pass custom parameter to a downstream job is by storing the key & value pair (key=value
) in a file and specifying the same file by selecting Parameters from properties file
option while calling downstream (in this example, job B) job. Refer the screenshot below:
Now you can access the variable in downstream job 'B' by using $BUILD_ID
. You would also like to enable the option Don't trigger if any files are missing
.
Upvotes: 3
Reputation: 2470
First you need add to the "install job" a string parameter called "BUILD_ID" and then once your build job is done you can "Trigger Parametrized build on on other project " and add the parameter of the next build being the BUILDID=%BuildID%
For more info on paramterized job on Jenkins read the following link: https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build
you might need to install a plugin for that. Link above.
Upvotes: 1