-
Bug
-
Resolution: Fixed
-
Minor
-
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>