Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-41270

Inaccurate generated dsl in api-viewer for extensible-choice-parameter-plugin

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: job-dsl-plugin
    • Labels:
    • Environment:
      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
    • Similar Issues:

      Description

      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

      { choiceListText(“item1\nitem2”) defaultChoice('Top') addEditedValue(false) whenToAdd('triggered') }

      }
      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!

        Attachments

          Activity

          markosrendell Markos Rendell created issue -
          scm_issue_link SCM/JIRA link daemon made changes -
          Field Original Value New Value
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          daspilker Daniel Spilker made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            Assignee:
            daspilker Daniel Spilker
            Reporter:
            markosrendell Markos Rendell
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: