I want to run jenkins job using jenkinsfile with list of all parameters value or with individual value from parameter list.
def deploy(env) {
step([$class: 'UCDeployPublisher',
siteName: siteName,
deploy: [
$class: 'com.urbancode.jenkins.plugins.ucdeploy.DeployHelper$DeployBlock',
deployApp: appName,
deployEnv: 'DEV',
deployVersions: "${compName}:${version}",
deployProc: simpleDeploy,
deployOnlyChanged: false,
deployReqProps: "ID=${params.ID}"
]])
CHOICES = [ 'id1', 'id2', 'id3', 'id4', 'id5' ]
PARAMETERS = CHOICES + "all"
parameters {
choice(
name: 'ID',
choices: PARAMETERS,
)
stage (DEV') {
steps {
script {
if (params.ID == "all"){
CHOICES.each {
echo "$it"
}
deploy('devl') ===> this will call my deploy function
}
else {
echo "$params.ID"
deploy('devl') ===> this will call my deploy function
}
}
}
}
I was able to run job using bye selecting each value from droplist. But I also want to the run the job with all values from ID list. I tried with all but it is not taking all the the values 'id1', 'id2', 'id3', 'id4', 'id5'
You would need to define the choices in a var outside of the parameter and then use that as
choices
e.g.