How can I pass the array variable into the global variable in groovy? It works perfectly without if-else.
choiceArray = []
if (appName == 'ms'){
['78', '99', '10'].each {
"${choiceArray}" << it
}
}
else if (appName == 'ms2'){
['12', '34', '56'].each {
"${choiceArray}" << it
}
}
pipeline {
parameters {
string (name: 'Branch', defaultValue: 'master', description: 'Select Branch')
choice(name: 'Environment', choices: choiceArray, description: 'Choose Environment')
if(...){
choiceArray.addAll(['78', '99', '10'])
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.