gojenkins icon indicating copy to clipboard operation
gojenkins copied to clipboard

Get Choices from ChoiceParameterDefinition?

Open TJM opened this issue 4 years ago • 7 comments

Feature Request: Are we able to get the list of choices from the ChoiceParameterDefinition job parameter type?

TJM avatar Jan 25 '21 22:01 TJM

@TJM do you mean be able to pass a choice to parameter? could you specify which function your question is about?

figo avatar Feb 26 '21 18:02 figo

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):

Screen Shot 2021-02-26 at 2 00 36 PM
<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>

TJM avatar Feb 26 '21 21:02 TJM

I have the same problem,like this

eryajf avatar Mar 24 '21 12:03 eryajf

@eryajf , @TJM interested to submit a fix?

figo avatar Mar 24 '21 17:03 figo

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.

TJM avatar Mar 24 '21 19:03 TJM

I actually have a fix for this in my fork if you want to merge it in. https://github.com/kireledan/gojenkins/commit/5a861f02944132ab456dcc171b132e3b360e3847

kireledan avatar Apr 09 '21 19:04 kireledan