So I figured out how to do this, I wrote a function that will return the
value of the variable that is required. First parameter is the jenkins job,
then its the build number of the job that you require and finally the
variable name,
def getJobVariable(jobName,buildId,varName){
job = Jenkins.instance.getItemByFullName(jobName)
newJob = job.getBuildByNumber(buildId)
return newJob.getEnvVars().get(varName,null)
}
api = build job: 'PipelineVarTest'
buildID = api.getNumber()
echo getJobVariable('PipelineVarTest',15,'ARTIFACT_TO_DEPLOY')
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/98b938e9-7a8f-4e3b-8b0f-c173c68d741d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.