简体   繁体   English

根据在第一份工作中选择的选项,如何使用动态参数插件在Jenkins中触发另一份工作

[英]based on options selected in first job, how to trigger another job in Jenkins using Dynamic parameter plugin

I have 3 Jenkins jobs 'J1', 'J2', 'J3'. 我有3个Jenkins职位'J1','J2','J3'。 Now I have to create another Job 'Jselect' which takes user inputs or a drop down having values J1, J2, J3. 现在,我必须创建另一个Job'Jselect',它接受用户输入或具有值J1,J2,J3的下拉菜单。 Based on the user selection it should trigger the jobs J1 or J2 or J3. 根据用户选择,它应该触发作业J1或J2或J3。

To achieve this, I installed DynamicParameter plugin and created the job 'JSelect'. 为此,我安装了DynamicParameter 插件并创建了作业“ JSelect”。

In JSelect job, I selected 'This build is parameterized' option and then added a Dynamic Choice Parameter. 在JSelect作业中,我选择了“此构建已参数化”选项,然后添加了“动态选择参数”。

Provided the name as : Choose Target Job: 提供的名称为:选择目标作业:

Choices Script as : def list=['J1','J2','J3'] 选择脚本为:def list = ['J1','J2','J3']

When I Saved and build the job, a dropdown is coming as expected. 当我保存并构建作业时,将出现一个预期的下拉列表。 But Iam not understanding where to capture this input and how to call other jobs based on this input. 但是我不了解在哪里捕获此输入以及如何基于此输入调用其他作业。

I am on the right approach? 我采用正确的方法吗? Can someone please help on how to achieve this? 有人可以帮忙实现此目标吗?

you need to trigger J1/J2/J3 based on some condition from Jselect. 您需要根据Jselect中的某些条件触发J1 / J2 / J3。

I suggest you the below approach. 我建议您采用以下方法。

Hope its resolves your issue. 希望它能解决您的问题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM