How to pass environment variable to downstream job?

时间:2016-04-04 17:36:20

标签: jenkins

I have an environment variable in a file in one job that I want to pass to another job.

In JobA,

enter image description here

In JobB:

enter image description here

But JOB_A_VERSION is not getting evaluated in the context of JobA. It's just showing up as the text.

2 个答案:

答案 0 :(得分:0)

Edit: Nevermind, this isnt the issue here. Try $JOB_A_VERSION or ${JOB_A_VERSION} un unix-like systems. In case of windows batch you would have to use %JOB_A_VERSION%.

You need to check This build is parameterized in the configuration of JobB and add the parameter you expect, aswell as how to interpret its content, i.e. you'd probably chose Text parameter here.

答案 1 :(得分:0)

通过属性文件传递参数。

在jobA中,

echo "MY_KEY=myvalue" > other_job_properties.txt

在其他项目上触发参数化构建 - >属性文件中的参数 - > other_job_properties.txt