如何将Jenkins中的Active Choice参数中的MultiSelect值转换为数组或列表?

时间:2018-09-21 13:27:55

标签: jenkins groovy jenkins-plugins jenkins-pipeline

我在詹金斯中使用'list'MultiSelect参数对作业进行了参数化: enter image description here

我只想使用选定的值来构建此作业: enter image description here

为此,我想将此选定的值传递给此作业中的管道脚本,然后将它们转换为数组或列表。

以下代码无法正常运行: enter image description here

请帮我用Groovy编写适当的代码,以将选定的值转换为数组或列表。

谢谢, 吻合症

1 个答案:

答案 0 :(得分:0)

假设有问题的参数名称“列表”和属性设置,下面的管道代码对我有用。

String [] arr =“ $ {params.list}”。split(','); 为(x in arr){     回声“ $ x \ n” }

这将在新行上打印每个选定的值。