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

Unable to specify ExecuteDslScripts.additionalParameters from Groovy

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • job-dsl-plugin
    • None

      I'm trying to set additionalParameters from Groovy code, similar to JENKINS-44128.

      steps {
      	jobDsl {
      		additionalClasspath(somePath)
      		removedJobAction('DELETE')
      		removedViewAction('DELETE')
      		targets(someTargets)
      		additionalParameters([arg1: 'test', arg2: 'test2'])
      	}
      }
      

      Whatever I do, I cannot specify the map of additionalParameters. I always get:

      ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.additionalParameters() is applicable for argument types: (java.util.LinkedHashMap) values: ...
      

      Could it be that maps cannot be passed at all, atm, maybe because they are not handled in https://github.com/jenkinsci/job-dsl-plugin/blob/master/job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/structs/DescribableContext.groovy#L72 ?

          [JENKINS-60439] Unable to specify ExecuteDslScripts.additionalParameters from Groovy

          Raphael added a comment -

          +1 – I'm not seeing additionalParameters in the Job DSL API Viewer, either.

          Workaround: Instead of freeStyleJob, I use a pipelineJob with cpsScm and reference a Jenkinsfile that uses the parameter as documented at User Power Moves > Use Job DSL in Pipeline Scripts.

          That works, but spreads the job in two files.
          Then again, there's much more logic available in a pipeline script compared to JobDsl; for instance, changing removedJobAction based on the branch building jobs from was a log easier.

          Raphael added a comment - +1 – I'm not seeing additionalParameters in the Job DSL API Viewer, either. Workaround: Instead of freeStyleJob , I use a pipelineJob with cpsScm and reference a Jenkinsfile that uses the parameter as documented at User Power Moves > Use Job DSL in Pipeline Scripts . That works, but spreads the job in two files. Then again, there's much more logic available in a pipeline script compared to JobDsl; for instance, changing removedJobAction based on the branch building jobs from was a log easier.

            jamietanna Jamie Tanna
            capf Carsten Pfeiffer
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: