-
Bug
-
Resolution: Fixed
-
Blocker
-
None
-
Jenkins 1.505, Groovy 1.13
Hi,
I've been happily using the Groovy plugin 1.12 to execute some complex code in the macro expansion.
Unfortunately, in 1.13 it does not work anymore. This is what I get in the output of a job:
FATAL: null
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:542)
at groovy.lang.Binding.setVariable(Binding.java:77)
at groovy.lang.GroovyShell.setVariable(GroovyShell.java:568)
at hudson.plugins.groovy.SystemGroovy.perform(SystemGroovy.java:76)
at hudson.plugins.groovy.GroovyTokenMacro.evaluate(GroovyTokenMacro.java:68)
at org.jenkinsci.plugins.tokenmacro.DataBoundTokenMacro.evaluate(DataBoundTokenMacro.java:177)
at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:177)
at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:153)
at org.jenkinsci.plugins.buildnamesetter.BuildNameSetter.setDisplayName(BuildNameSetter.java:50)
at org.jenkinsci.plugins.buildnamesetter.BuildNameSetter.setUp(BuildNameSetter.java:37)
at hudson.model.Build$BuildExecution.doRun(Build.java:154)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:593)
at hudson.model.Run.execute(Run.java:1567)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:237)
For the test I used the Build Name Setter plugin with the option
${GROOVY,script="return 'build_name'"}
but the failure is reproducible with anything that call token expansion and with any Groovy code (I use something more complex than that in my real jobs).
To be able to work I had to revert 1.12, but I would profit from the change in 1.13 because I actually need to manipulate an environment variable in the token.
Thanks
Marco
I have prepared this simple fix:
https://github.com/kartoflanka/groovy-plugin/commit/3109383f130768a7d35691366a7d7c2362560c9b
The macro expansion for GROOVY works again now.