-
Bug
-
Resolution: Unresolved
-
Minor
-
None
Running this works as expected
node("label") { properties([ parameters([ [$class: 'ChoiceParameter', name: "CONFIGURATION", choiceType: "PT_CHECKBOX", script: [ $class: 'GroovyScript', script: [ classpath: [], sandbox: true, script: ''' return [ "A:selected", "B", "C" ] ''' ] ] ], [$class: 'CascadeChoiceParameter', choiceType: 'PT_CHECKBOX', name: 'CHOICE', referencedParameters: 'CONFIGURATION', script: [ $class: 'GroovyScript', fallbackScript: [ classpath: [], sandbox: true, script: ''' return ["ERROR"] ''' ], script: [ classpath: [], sandbox: true, script: ''' def values = [] if (CONFIGURATION.contains("A")) { values.add("A") } if (CONFIGURATION.contains("B")) { values.add("B") } if (CONFIGURATION.contains("C")) { values.add("C") } return values ''' ] ] ] ]) ]) stage("OUTPUT") { echo params.CONFIGURATION echo params.CHOICE } }
But using extendedChoice of type PT_CHECKBOX instead of ChoiceParameter
does not
node("label") { properties([ parameters([ extendedChoice( name: "CONFIGURATION", type: "PT_CHECKBOX", multiSelectDelimiter: ",", value: "A,B,C", defaultValue: "A", visibleItemCount: 3 ), [$class: 'CascadeChoiceParameter', choiceType: 'PT_CHECKBOX', name: 'CHOICE', referencedParameters: 'CONFIGURATION', script: [ $class: 'GroovyScript', fallbackScript: [ classpath: [], sandbox: true, script: ''' return ["ERROR"] ''' ], script: [ classpath: [], sandbox: true, script: ''' def values = [] if (CONFIGURATION.contains("A")) { values.add("A") } if (CONFIGURATION.contains("B")) { values.add("B") } if (CONFIGURATION.contains("C")) { values.add("C") } return values ''' ] ] ] ]) ]) stage("OUTPUT") { echo params.CONFIGURATION echo params.CHOICE } }
Changing the type of extentdedChoise to PT_SINGLE_SELECT from PT_CHECKBOX makes it work again. But that's not the solution here as I need multi choice checkboxes.