-
Bug
-
Resolution: Fixed
-
Minor
-
Jenkins ver. 2.7.4
extensible-choice-parameter:1.3.2
job-dsl:1.48
also tried with:
extensible-choice-parameter:1.3.3
job-dsl:1.57
Love the job-dsl-plugin api viewer i.e. <base url>/jenkins/plugin/job-dsl/api-viewer/index.html
However when browsing the generated dsl for the extensibleChoiceParameter plugin i.e.:
#method/hudson.model.ParameterDefinition$$List.extensibleChoiceParameterDefinition
It reports:
extensibleChoiceParameterDefinition {
choiceListProvider {
textareaChoiceListProvider {
whenToAdd(String value)
However having tried this DSL:
myJob.with{
parameters{
extensibleChoiceParameterDefinition {
name='MY_PARAM_NAME'
choiceListProvider {
textareaChoiceListProvider
}
editable(true)
description('My param')
}
It complains:
ERROR: (script, line 15) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.whenToAdd() is applicable for argument types: (java.lang.String) values: [triggered]
Finished: FAILURE
Looking up the plugin source code it does appear to want an ENUM:
https://github.com/jenkinsci/extensible-choice-parameter-plugin/blob/a2f0d8b271d2badfc34c98c4b9772a6e36b31784/src/main/java/jp/ikedam/jenkins/plugins/extensible_choice_parameter/AddEditedChoiceListProvider.java
So the bug is that I think the api-viewer is generating the wrong DSL.
I would perhaps not have raised this, but I don’t seem to be able to get the generated DSL to work at all. Since the ENUM seems to exist in a class that appears to need to run as System Groovy, I can’t import that class in my Job DSL groovy. E.g.
def temp = new jp.ikedam.jenkins.plugins.extensible_choice_parameter.GlobalTextareaChoiceListProvider()
unable to resolve class jp.ikedam.jenkins.plugins.extensible_choice_parameter.GlobalTextareaChoiceListProvider
unless I run in System Groovy step:
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: jp.ikedam.jenkins.plugins.extensible_choice_parameter.GlobalTextareaChoiceListProvider()
(shows class is found)
So possibly another issue is that dsl for classes that have to run as System Groovy don't work if you need ENUMs.
So I'm raising this bug primarily because I think the generated DSL is incorrect in some circumstances.
- But also on the off chance that anyone can shed any light on getting my generated DSL working. Thanks in advance!