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

Multiple parameters are not passed to Groovy build step

XMLWordPrintable

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

      When passing more than one parameter to a Groovy build step, only the first parameter is recognized.

      The following DSL snippet causes a java.lang.ArrayIndexOutOfBoundsException: 1 when running the job.

      job('example') { 
        steps {
          groovyCommand('println args[1]') {
            scriptParam('one')
            scriptParam('two')
          }
        }
      }
      

      The problem is that the DSL joins the parameters by newlines when generating the config XML, but the Groovy plugin changed the parameter parsing in versions 1.19 and 1.21 and now only allows space separated parameters. See JENKINS-23617 and JENKINS-24757.

      <project>
          ....
          <builders>
              <hudson.plugins.groovy.Groovy>
                  ...
                  <scriptParameters>one
      two</scriptParameters>
                  ...
              </hudson.plugins.groovy.Groovy>
          </builders>
          ...
      </project>
      

            daspilker Daniel Spilker
            daspilker Daniel Spilker
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: