def projectsString = ''
stage('debug') {
when {
branch 'master'
}
steps {
script {
def files = findFiles()
files.each {
f ->
if (f.directory) {
projectsString = projectsString + f.name + "\\" + "n "
echo projectsString
}
}
}
}
}
stage('debug2') {
when {
branch 'master'
}
input {
message "Choose"
ok "Submit"
parameters {
choice(name: 'CHOICES', choices: "${projectsString}", description: 'Please Select One')
}
}
steps {
script {
echo "Selected choice is : ${params.CHOICES}"
}
}
}
In the stage debug2, there are no choices, projectsString, even though I'm filling it with values in debug stage, not sure what I'm doing wrong, it's also a global variable
There is also a echo projectsString in debug stage, when I hardcode that string directly in the debug2 stage, the choices appear correclt