简体   繁体   English

如何将环境变量传递给下游工作?

[英]How to pass environment variable to downstream job?

I have an environment variable in a file in one job that I want to pass to another job. 我要传递给另一项作业的文件中有一个环境变量。

In JobA, 在JobA中

在此处输入图片说明

In JobB: 在JobB中:

在此处输入图片说明

But JOB_A_VERSION is not getting evaluated in the context of JobA. 但是JOB_A_VERSION不会在JobA的上下文中得到评估。 It's just showing up as the text. 它只是显示为文本。

Edit: Nevermind, this isnt the issue here. 编辑:没关系,这不是这里的问题。 Try $JOB_A_VERSION or ${JOB_A_VERSION} un unix-like systems. 尝试$JOB_A_VERSION${JOB_A_VERSION} unix类系统。 In case of windows batch you would have to use %JOB_A_VERSION% . 如果是Windows批处理,则必须使用%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, ie you'd probably chose Text parameter here. 您需要检查JobB的配置中是否JobB 参数进行了参数化 ,并添加了所需的参数以及如何解释其内容,即您可能在此处选择了Text参数

Passing parameters via a properties file works. 通过属性文件传递参数是可行的。

In jobA, 在jobA中

echo "MY_KEY=myvalue" > other_job_properties.txt

Trigger parametrized build on other projects -> Parameters from properties file -> other_job_properties.txt 在其他项目上触发参数化构建->属性文件中的参数-> other_job_properties.txt

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在詹金斯中将参数作为环境变量从上游作业传递到下游作业? 无需对下游工作进行参数化 - How to pass parameter as environment variable from upstream job to downstream job in jenkins? without downstream jobs being parametrized 如何将Python变量传递给管道中的下游作业 - How to pass Python variable to the downstream job in pipeline 如何使作业dsl设置的环境变量在下游作业中可用? - How to make environment variable set by job dsl avaiable in downstream jobs? 如何在Jenkins中将Shell变量传递给依赖/下游作业 - How to pass shell variable to dependent/downstream job in Jenkins 如何将$ {CHANGES}传递给下游工作? - How to pass ${CHANGES} to downstream job? 如何将参数传递给下游作业,但不应该触发下游作业? - How to pass parameter to the downstream job but shouldn't trigger the downstream job? 将数据(变量/参数)从一个下游作业传递到上游作业,以便将数据传递到另一个下游作业 - Passing data (variable/parameter) from one downstream job to upstream job in order to pass the data to another downstream job 如何将环境变量传递给另一个作业 Jenkins - How to pass environment variable to another job Jenkins 如何将文件传递给 Jenkins 中的下游作业 - How to Pass Files to downstream Job in Jenkins 如何在 Jenkins MultiJob 中将下游作业的描述传递给上游作业 - How to pass Description of downstream job to upstream job in Jenkins MultiJob
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM