bndr / gojenkins

Jenkins API Client in Go. Looking for maintainers to move this project forward.
Apache License 2.0
863 stars 443 forks source link

Get Choices from ChoiceParameterDefinition? #223

Open TJM opened 3 years ago

TJM commented 3 years ago

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

figo commented 3 years ago

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

TJM commented 3 years ago

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>
eryajf commented 3 years ago

I have the same problem,like this

figo commented 3 years ago

@eryajf , @TJM interested to submit a fix?

TJM commented 3 years ago

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.

kireledan commented 3 years ago

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

marksugar commented 2 weeks ago

@figo This issue is still ongoing, are we planning to fix it?