java.lang.IllegalArgumentException: Null value not allowed as an environment variable: REPOVERSION

Jenkins JIRA | Andres Garcia | 8 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Builds are not triggered via Poll SCM. This error is solved when server is restart. {noformat} ERROR: Build step failed with exception java.lang.IllegalArgumentException: Null value not allowed as an environment variable: REPOVERSION at hudson.EnvVars.put(EnvVars.java:356) at hudson.model.StringParameterValue.buildEnvironment(StringParameterValue.java:56) at hudson.model.ParametersAction.buildEnvVars(ParametersAction.java:89) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:953) at hudson.plugins.gradle.Gradle.performTask(Gradle.java:127) at hudson.plugins.gradle.Gradle.perform(Gradle.java:118) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785) at hudson.model.Build$BuildExecution.build(Build.java:205) at hudson.model.Build$BuildExecution.doRun(Build.java:162) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537) at hudson.model.Run.execute(Run.java:1741) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:408) Build step 'Invoke Gradle script' marked build as failure ERROR: Failed to evaluate groovy script. java.lang.IllegalArgumentException: Null value not allowed as an environment variable: REPOVERSION at hudson.EnvVars.put(EnvVars.java:356) at hudson.model.StringParameterValue.buildEnvironment(StringParameterValue.java:56) at hudson.model.ParametersAction.buildEnvVars(ParametersAction.java:89) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:953) at hudson.model.AbstractBuild$getEnvironment.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at notifybuild.run(notifybuild.groovy:12) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:627) at groovy.lang.Script.evaluate(Script.java:219) at groovy.lang.Script$evaluate.callCurrent(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) at Script1.run(Script1.groovy:1) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589) at org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder.perform(GroovyPostbuildRecorder.java:276) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726) at hudson.model.Build$BuildExecution.post2(Build.java:185) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671) at hudson.model.Run.execute(Run.java:1766) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:408) Build step 'Groovy Postbuild' marked build as failure {noformat} Version of Jenkins this bug is occurring {noformat} Jenkins ver. 1.625.3 {noformat} Version of groovy plugin {noformat} ver. 1.14 {noformat} Version of groovy postbuild plugin {noformat} ver. 1.8 {noformat} Groovy script {noformat} import groovyx.net.http.RESTClient import static groovyx.net.http.ContentType.* import hudson.model.* def repoversion = "X" def env = build.getEnvironment() def projectName = build.project.getName() def commit = env['GIT_COMMIT'] int CONNECTION_TIMEOUT = 30*1000; int SOCKET_TIMEOUT = 45*1000; try{ def solnet = new RESTClient( 'http://ip_adress/' ) solnet.getClient().getParams().setParameter("http.connection.timeout", new Integer(CONNECTION_TIMEOUT)) solnet.getClient().getParams().setParameter("http.socket.timeout", new Integer(SOCKET_TIMEOUT)) def resp = solnet.get( path : 'repo_get_version.php', query: ['name':projectName,'revision':commit]) if(resp.status == 200){ repoversion = resp.data.version } } catch(Exception e){ println e.getMessage() } def pa = new ParametersAction([ new StringParameterValue("REPOVERSION", repoversion) ]) // add variable to current job Thread.currentThread().executable.addAction(pa) {noformat}

    Jenkins JIRA | 8 months ago | Andres Garcia
    java.lang.IllegalArgumentException: Null value not allowed as an environment variable: REPOVERSION

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Null value not allowed as an environment variable: REPOVERSION

      at hudson.EnvVars.put()
    2. Hudson
      AbstractBuild$getEnvironment.call
      1. hudson.EnvVars.put(EnvVars.java:356)
      2. hudson.model.StringParameterValue.buildEnvironment(StringParameterValue.java:56)
      3. hudson.model.ParametersAction.buildEnvVars(ParametersAction.java:89)
      4. hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:953)
      5. hudson.model.AbstractBuild$getEnvironment.call(Unknown Source)
      5 frames
    3. Groovy
      AbstractCallSite.call
      1. org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      2. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      3. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
      3 frames
    4. Unknown
      notifybuild.run
      1. notifybuild.run(notifybuild.groovy:12)
      1 frame
    5. Groovy
      AbstractCallSite.callCurrent
      1. groovy.lang.GroovyShell.evaluate(GroovyShell.java:580)
      2. groovy.lang.GroovyShell.evaluate(GroovyShell.java:627)
      3. groovy.lang.Script.evaluate(Script.java:219)
      4. groovy.lang.Script$evaluate.callCurrent(Unknown Source)
      5. org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
      6. org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
      7. org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
      7 frames
    6. Unknown
      Script1.run
      1. Script1.run(Script1.groovy:1)
      1 frame
    7. Groovy
      GroovyShell.evaluate
      1. groovy.lang.GroovyShell.evaluate(GroovyShell.java:580)
      2. groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)
      3. groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
      3 frames
    8. org.jvnet.hudson
      GroovyPostbuildRecorder.perform
      1. org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder.perform(GroovyPostbuildRecorder.java:276)
      1 frame
    9. Hudson
      Executor.run
      1. hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      2. hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
      3. hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
      4. hudson.model.Build$BuildExecution.post2(Build.java:185)
      5. hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
      6. hudson.model.Run.execute(Run.java:1766)
      7. hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      8. hudson.model.ResourceController.execute(ResourceController.java:98)
      9. hudson.model.Executor.run(Executor.java:408)
      9 frames