简体   繁体   English

如何在詹金斯中将参数作为环境变量从上游作业传递到下游作业? 无需对下游工作进行参数化

[英]How to pass parameter as environment variable from upstream job to downstream job in jenkins? without downstream jobs being parametrized

I am using a parametrized job to trigger pipeline jobs job1,job2 and job3. 我正在使用参数化作业来触发管道作业job1,job2和job3。 My intention is that by default job1,job2,job3 should run on node "A" and whenever I use parametrized job, and select node "B" manually then all downstream jobs i,e job1,job2 and job3 should run on the node "B". 我的意图是,默认情况下,job1,job2,job3应该在节点“ A”上运行,并且每当我使用参数化的作业,并手动选择节点“ B”时,所有下游作业,即job1,job2和job3应该在节点“ A”上运行B”。

I used nodelabel parameter plugin but only parent job will run accordingly as selected parameter but downstream jobs are not triggered on the selected parameter in the parent job. 我使用了nodelabel参数插件,但是只有父作业将作为选定参数运行,但是下游作业不会在父作业中的选定参数上触发。

Make a job parameter for job1, job2 and job3. 为job1,job2和job3设置一个job参数。 Use this parameter for nodelabel. 将此参数用于nodelabel。 Make the default for this parameter nodeB. 将此参数设置为默认值nodeB。 When you start the job with the parametrized job set the parameter nodeA as seen below: 使用参数化作业启动作业时,请设置参数nodeA,如下所示:

build job: 'job1', parameters: [[$class: 'StringParameterValue', name:'nodeA']]

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

相关问题 将数据(变量/参数)从一个下游作业传递到上游作业,以便将数据传递到另一个下游作业 - Passing data (variable/parameter) from one downstream job to upstream job in order to pass the data to another downstream job Jenkins-如何将参数从下游作业传递到其父上游? - Jenkins - How to pass parameters from a downstream job to its parent upstream? Jenkins的上游和下游工作 - Upstream and DownStream Job on Jenkins 如何在 Jenkins MultiJob 中将下游作业的描述传递给上游作业 - How to pass Description of downstream job to upstream job in Jenkins MultiJob 从上游 Jenkins 管道作业调用多个下游作业 - Calling multiple downstream jobs from an upstream Jenkins pipeline job 如何在不构建上游作业的情况下将参数从上游作业传递给下游作业 - how to pass parmeter to downstream job from upstream job without building upstream job 如何将环境变量传递给下游工作? - How to pass environment variable to downstream job? 如果正在等待Jenkins中的上游作业完成,如何停止下游作业的运行? - How to stop a downstream job from being run if it is waiting for upstream job to finish in Jenkins? 运行jenkins作业而不触发下游作业 - Run jenkins job without triggering downstream jobs 如何使作业dsl设置的环境变量在下游作业中可用? - How to make environment variable set by job dsl avaiable in downstream jobs?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM