如何基于选择的Choice参数定义Jenkins String参数 [英] How to define a Jenkins String parameter based on the Choice parameter selected

查看:251
本文介绍了如何基于选择的Choice参数定义Jenkins String参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置工作,这需要用户在所选的Choice上输入输入字符串

I am trying to setup a job , which requires the user to enter a input String on the Choice selected

我看过各种插件,但是所有插件都可以选择Choice参数,但不能选择一个字符串

I have seen various plugin, but all of them have the option of Choice parameters to be picked up from but not a string one

场景-产品(abc,def,ghi,jkl) 如果产品名称仅为"def" ,则用户需要输入从属修订号作为字符串参数"12356",如果选择了任何其他产品,则用户不应有任何选择来输入字符串参数

Scenario - Product ( abc, def , ghi , jkl) If the product name is only "def" then the user need to enter the dependent revision number as a string parameter "12356" , if any other product is selected then user shouldnt have any option to enter the string parameter

感谢您的帮助

推荐答案

在Jenkins带参数的构建页面中,这是不可能的. 参数会一次全部加载,并且不能具有依赖于另一个参数值的逻辑.

This is not possible in Jenkins build with parameters page. Parameters are loaded all at once, and cannot have logic that depends on the value of another one.

您有一些选择,一些简单的选择是:

You have a few options, some easy ones are:

  1. 在JenkinsFile/Pipeline中,一旦作业开始,请评估产品参数的值,如果为'def',则提示用户进行后续输入 https://jenkins.io/doc/pipeline/steps/pipeline-input -step/
  2. 将字符串字段作为参数存在,但是在描述中请注意,仅当product =='def'时才需要,否则忽略它而与值无关
  1. In JenkinsFile/Pipeline, once job has kicked off, evaluate value of the product param and if 'def' Prompt user for subsequent input https://jenkins.io/doc/pipeline/steps/pipeline-input-step/
  2. Have the string field present as a param, but in the description note that it is only required when product == 'def' and otherwise ignore it regardless of value

这篇关于如何基于选择的Choice参数定义Jenkins String参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆