gojenkins
gojenkins copied to clipboard
Get Choices from ChoiceParameterDefinition?
Feature Request: Are we able to get the list of choices from the ChoiceParameterDefinition job parameter type?
@TJM do you mean be able to pass a choice to parameter? could you specify which function your question is about?
When you have a ChoiceParameterDefinition
you can specify any string to it, but there does not appear to be a way to get the list of valid choices, perhaps to present them to a user or to validate. Here is an example (pardon the immaturity):

<hudson.model.ChoiceParameterDefinition>
<name>kind</name>
<description>Kind of fart</description>
<choices class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>SBD</string>
<string>Popcorn (dry)</string>
<string>Wet</string>
<string>Juicy</string>
</a>
</choices>
</hudson.model.ChoiceParameterDefinition>
I have the same problem,like this
@eryajf , @TJM interested to submit a fix?
We are actually migrating away from Jenkins towards gitlab-ci, so its probably a moot issue for us at this point. This is just to support a few legacy projects.
I actually have a fix for this in my fork if you want to merge it in. https://github.com/kireledan/gojenkins/commit/5a861f02944132ab456dcc171b132e3b360e3847