Reputation: 199
I have parameterized job with 'list' MultiSelect parameter in Jenkins:
I want to build this job only with selected values:
And for this purpose, I want to pass this selected values to pipeline script in this job and convert them into an array or list.
The following code doesn't work properly:
Please, help me to write the proper code in groovy to convert selected values to array or list.
Thanks, Anastasiia
Upvotes: 1
Views: 6135
Reputation: 26
Assuming parameter name "list" and property setting described in question, below pipeline code worked for me.
String[] arr= "${params.list}".split(','); for (x in arr) { echo "$x \n" }
This will print each selected values on new line.
Upvotes: 1