2

I have the following declarative pipeline. It defines checkbox multi-choice parameter:

pipeline {
    agent any 
    options {
        ansiColor('xterm')                    
    }
    parameters { 
        extendedChoice description: '', multiSelectDelimiter: ',', name: 'NAMES', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_CHECKBOX', value:'a,b,c', visibleItemCount: 3
    } 
    stages {
      stage('Run on all') {

        steps { 
            script {
                  println params.NAMES 
            }
        }   
      }
    }

}

My goal is to call the pipeline via Jenkins CLI where passed values to NAMES parameter signifies selected checkboxes.

Running java -jar jenkins-cli.jar -s http://localhost:8080 -auth u:p -p NAMES='a' causes empty string to be printed by println params.NAMES

Expected a to be printed after calling the pipeline via Jenkins cli client.

The only way that worked is adding commas after a: java -jar jenkins-cli.jar -s http://localhost:8080 -auth u:p -p NAMES='a,,'

Is it the correct syntax to pass checkbox selections of extendedChoice type parameter?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.