PIPELINE: any ideas how to use a multiple choices parameter in the input step and BlueOcean compatible?

4,705 views
Skip to first unread message

Victor Martinez

unread,
Aug 4, 2017, 8:05:41 AM8/4/17
to Jenkins Users
Hi there,

Any ideas how I can create a choice input step which allows multiple selections?  I've tried to use:
Thanks


Victor Martinez

unread,
Aug 4, 2017, 9:28:41 AM8/4/17
to Jenkins Users
I was able to programmatically generate an input form based on a list of parameters

@NonCPS
def createBooleanParameter(String desc, String value){
   return [$class: 'BooleanParameterDefinition', defaultValue: true, description: desc, name: value]
}
 
node {
 def userInput = input(
 id: 'userInput', message: 'The below Scenarios failed, let\'s rerun them?', parameters: [
    createBooleanParameter('ScenarioA','Platform1-VariantA'),
    createBooleanParameter('ScenarioB','Platform1-VariantB'),
    createBooleanParameter('ScenarioC','Platform3-VariantA')
 ])
 
 
// BooleanParameters are based on Key=> String based and Value=> Boolean based
 
// then iterate through the list of parameters which are enable
 userInput?.findAll{ it.value }?.each {
    println it.key.toString()
 }


But unfortunately I need a bit more of dynamism, which means, I'd need to inject those input parameters on the fly since I don't know them until certain stage of the pipeline.

Cheers


Reply all
Reply to author
Forward
0 new messages