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

Token macro expansion not working in Groovy plugin 1.13

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Component/s: groovy-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.505, Groovy 1.13
    • Similar Issues:

      Description

      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

        Attachments

          Activity

            People

            • Assignee:
              lvotypkova Lucie Votypkova
              Reporter:
              marcocle Marco Clemencic
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: