Is there any support for multi-select in a declarative pipeline?
UPDATE: yes, apparently there is. Through viewing pipeline error codes, browsing stack overflow and eventually, the plugin source code, I see that after installing the plugin, extendedChoice is another valid type you can use in your declarative "parameters {" section, as in:
extendedChoice(name: "favorite_letters", type: "PT_CHECKBOX", multiSelectDelimiter: " ", // this only defines delimiter used in the output string value, not used for parsing value input, which must be comma-separated! value: """a, b, c, d, e, f""", defaultValue: "d, f", description: "Select your favorite letter(s)" )
There is woefully little documentation, however, on how all the various "type"s of extendedChoice parameters actually work. The best docs I could find was by looking at my pipeline job configuration through the web interface, which of course shows UI for all the possible types:
..and their subparams:
So far, the JSON types look most interesting and extensible. I hope I can figure out how those work without spending the rest of the day sleuthing..
Is there the possibility to limit number of choices? I have more than 10 values and I would like to limit only 3 selections options , in case of more than 3 show the echo “”Number of choices exceded”
Comments
5 comments
This is not useable with blue ocean interface
Is there any support for multi-select in a declarative pipeline?
Is there any support for multi-select in a declarative pipeline?
UPDATE: yes, apparently there is. Through viewing pipeline error codes, browsing stack overflow and eventually, the plugin source code, I see that after installing the plugin, extendedChoice is another valid type you can use in your declarative "parameters {" section, as in:
type: "PT_CHECKBOX",
multiSelectDelimiter: " ", // this only defines delimiter used in the output string value, not used for parsing value input, which must be comma-separated!
value: """a, b, c, d, e, f""",
defaultValue: "d, f",
description: "Select your favorite letter(s)"
)
There is woefully little documentation, however, on how all the various "type"s of extendedChoice parameters actually work. The best docs I could find was by looking at my pipeline job configuration through the web interface, which of course shows UI for all the possible types:
..and their subparams:
So far, the JSON types look most interesting and extensible. I hope I can figure out how those work without spending the rest of the day sleuthing..
Hi, great example, I’m using in my scenario
Is there the possibility to limit number of choices? I have more than 10 values and I would like to limit only 3 selections options , in case of more than 3 show the echo “”Number of choices exceded”
Thank you so much
this is nice, but doesn't have enough examples.
For example, how it is possible to put script in that ExtendedChoicePlugin?
what each field means in ExtendedChoiceParameterDefinition?
small update:
plugin is quite old and non-secure. So in some envs it won't be possible to use it.
Please sign in to leave a comment.