在Jenkins中将父参数传递给子构建 [英] Passing parent parameters to child build in Jenkins
问题描述
我已经涉猎了 Parameterized Trigger Plugin
,但是没有任何运气.我基本上希望实现的是将父作业的参数传递给子作业.在我的父作业中,我定义了一个变量 var
,该变量的值在运行时希望传递给子作业 Test_child
.
I have dabbled with Parameterized Trigger Plugin
but haven't had any luck. What I am basically looking to achieve is pass over the parent job's parameters to the child job. In my parent job, I have defined a variable var
whose value at run time I want to be able to pass to the child job Test_child
.
在我的子工作 Test_child
中,设置如下:-
In my child job Test_child
, following is the set-up:-
当我在子作业中回显相同的参数变量时,我看不到传递任何值.
And when I echo the same parameter variable in the child job, I don't see any values being passed on.
推荐答案
在构建后操作
下的父作业中,您正在使用在其他项目上触发参数化的构建
插件是正确的方法,但您没有传递任何参数.您需要添加参数,如下图所示
In parent job under Post-build Actions
you are using Trigger parameterized build on other projects
plugin which is the right method but you are not passing any parameter. You need to add parameter as shown in below image
因此 var
中存在的任何值都将传递给子作业,在您的情况下,即 Test_child
,您可以使用相同的变量 var
Test_child
中的code>.
So whatever value is present in var
it will be passed to child job and in your case i.e. Test_child
and you can use the same variable var
in Test_child
.
这篇关于在Jenkins中将父参数传递给子构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!