我们如何访问Jenkins工作流输入参数值? [英] How do we access Jenkins workflow input parameter values?

查看:254
本文介绍了我们如何访问Jenkins工作流输入参数值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Jenkins工作流输入步骤中指定的参数是否可用于消耗量和条件逻辑?我们如何获得这些价值?例如我们如何在以下情况下获取并引用checkbox参数的true或false值:

Presumably the parameters that are specified in a Jenkins workflow input step are available for consumption and conditional logic? How do we obtain those values? e.g. how do we obtain and reference true or false value for the checkbox parameter in the following:

input id: 'Proceed1', message: 'Proceed or abort?', parameters: [[$class: 'BooleanParameterDefinition', defaultValue: false, description: '', name: 'Please confirm you agree with this']]

推荐答案

input步骤的返回值将是提交的值(对于BooleanParameterDefinition,则为boolean).如果有多个参数,则会得到一个Map,因此可以通过name查找每个参数的值.

The return value of the input step will be the submitted value (a boolean, in the case of BooleanParameterDefinition). If there are multiple parameters, you get a Map so you can look up the value of each by name.

如您的示例所示,如果您只想要OK/Cancel语义,则可以完全跳过parameters.如果用户取消,流程将中止.如果他们接受,则没有返回值(从技术上来说,null).

By the way you can skip parameters altogether if you simply want OK/Cancel semantics, as your example seems to imply. If the user cancels, the flow aborts. If they accept, there is no return value (well, null technically).

这篇关于我们如何访问Jenkins工作流输入参数值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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