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

问题描述 投票:0回答:1

我在Jenkins:qazxsw poi中使用'list'多选参数参数化了作业

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

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

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

请帮我在groovy中编写正确的代码,将选定的值转换为数组或列表。

谢谢,Anastasiia

jenkins groovy jenkins-plugins jenkins-pipeline
1个回答
0
投票

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

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

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

© www.soinside.com 2019 - 2024. All rights reserved.