Reputation: 533
I have a Jenkins build job. It has section for shell command where I read "version" of the current application that i am building. Now, i want to set the Jenkins custom variable "VERSION" with the "version" in the same shell command section. I need to pass this value as parameter to some other job being triggered after successful build of this job.
Now, I would pass the Jenkins variable VERSION to some other Job.
Please suggest how can I do this.
Upvotes: 5
Views: 17459
Reputation: 533
I could get some clue from Suresh's answer. I did the following steps and it worked well.
Step 1: Install Plugin “EnvInject Plugin”.
Step 2: Set the custom env variable and store that in env.properties
Step 3: Add POST Build Action, “Trigger parameterized build on other projects”
Step 4: Add the variables that the Post Build Job is expecting: Here the BUILD_NUMBER and FILE_VERSION are two parameterized variables that the next Job is expecting. FILE_VERSION is passed as parameters from properties file which was stored in STEP 2.
Upvotes: 3
Reputation: 750
Use EnvInject Plugin to inject runtime variables into Jenkins build process so that you can use in other build steps or you can pass it on to other Job's as input parameter.
Upvotes: 3