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

Error: No signature of method for DescribableContext

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • job-dsl-plugin
    • None
    • Linux, CentOS 7.5
      Jenkins 2.121.1
      job-dsl-plugin 1.70

      The following job DSL script:

      pipelineJob("adam-$type") {
          parameters {
              choice {
                  name 'ENVIRONMENT'
                  choices 'development\ntesting\nproduction'
                  description '''which'''
              }
          }
          definition {
            cps {
              ...
            }
          }
      }
      

      worked fine so far, last run of the seed job was May, 25th.

      Currently, the job-dsl plugin is version 1.70 and running the seed job now results in the following error:

      Processing DSL script deploy.groovy
          ERROR: (deploy.groovy, line 22) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.choices() is applicable for argument types: (java.lang.String) values: [development
          testing
          production]
          Possible solutions: collect()
      

      Changing the code to use an array:

      choices ['development', 'testing', 'production'].toArray()
      

      reports:

      ERROR: (deploy.groovy, line 22) No such property: choices for class: javaposse.jobdsl.plugin.structs.DescribableContext
      

      Also, the "Job DSL API Reference" online help is mostly unhelpful, since going to /plugin/job-dsl/api-viewer/index.html#path/pipelineJob-parameters-choice-choices and clicking on the ellipsis inside {{choices

      { ... }

      }}, seems to display all and every available DSL method like accountInfo, administrator, apiToken, et cetera but not something relevant in the current context.

      OK, using `choiceParam` with a different call syntax this works again:

      choiceParam('ENVIRONMENT', ['development', 'testing', 'production'], '''which''')
      

      But, why did it break?

            daspilker Daniel Spilker
            jenkey Claudio B
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: