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

Jenkins JIRA | Sylvain Benner | 3 years ago
  1. 0

    When one uses Predefined Generator Parameters to trigger a parameterized build, this exception is raised where VARIABLE_NAME is the name of a defined Generator Parameter: java.lang.IllegalArgumentException: Null value not allowed as an environment variable: VARIABLE_NAME at hudson.EnvVars.put(EnvVars.java:356) at hudson.model.StringParameterValue.buildEnvironment(StringParameterValue.java:56) at hudson.model.ParametersAction.buildEnvVars(ParametersAction.java:85) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:883) at hudson.plugins.parameterizedtrigger.AbstractBuildParameters.getEnvironment(AbstractBuildParameters.java:47) at org.jenkinsci.plugins.jobgenerator.parameterizedtrigger.PredefinedGeneratorParameters.getAction(PredefinedGeneratorParameters.java:59) at org.jenkinsci.plugins.jobgenerator.GeneratorRun$GeneratorImpl.gatherDownstreamGenerators(GeneratorRun.java:493) at org.jenkinsci.plugins.jobgenerator.GeneratorRun$GeneratorImpl.doRun(GeneratorRun.java:299) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:523) at hudson.model.Run.execute(Run.java:1688) at org.jenkinsci.plugins.jobgenerator.GeneratorRun.run(GeneratorRun.java:284) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:231) at hudson.model.OneOffExecutor.run(OneOffExecutor.java:43)

    Jenkins JIRA | 3 years ago | Sylvain Benner
    java.lang.IllegalArgumentException: Null value not allowed as an environment variable: VARIABLE_NAME
  2. 0

    When one uses Predefined Generator Parameters to trigger a parameterized build, this exception is raised where VARIABLE_NAME is the name of a defined Generator Parameter: java.lang.IllegalArgumentException: Null value not allowed as an environment variable: VARIABLE_NAME at hudson.EnvVars.put(EnvVars.java:356) at hudson.model.StringParameterValue.buildEnvironment(StringParameterValue.java:56) at hudson.model.ParametersAction.buildEnvVars(ParametersAction.java:85) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:883) at hudson.plugins.parameterizedtrigger.AbstractBuildParameters.getEnvironment(AbstractBuildParameters.java:47) at org.jenkinsci.plugins.jobgenerator.parameterizedtrigger.PredefinedGeneratorParameters.getAction(PredefinedGeneratorParameters.java:59) at org.jenkinsci.plugins.jobgenerator.GeneratorRun$GeneratorImpl.gatherDownstreamGenerators(GeneratorRun.java:493) at org.jenkinsci.plugins.jobgenerator.GeneratorRun$GeneratorImpl.doRun(GeneratorRun.java:299) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:523) at hudson.model.Run.execute(Run.java:1688) at org.jenkinsci.plugins.jobgenerator.GeneratorRun.run(GeneratorRun.java:284) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:231) at hudson.model.OneOffExecutor.run(OneOffExecutor.java:43)

    Jenkins JIRA | 3 years ago | Sylvain Benner
    java.lang.IllegalArgumentException: Null value not allowed as an environment variable: VARIABLE_NAME
  3. 0

    Jenkins fails on periodic build with Dynamic Choice Parameter Groovy script

    Stack Overflow | 2 years ago
    java.lang.IllegalArgumentException: Null value not allowed as an environment variable: Restore
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    I'm trying to use the Dynamic Choice Parameter plugin to set up a parameterized build in Jenkins. The parameters should be the names of some directory's in a directory of the working directory of the job (i.e. `/var/lib/jenkins/workspace/JobName/dirToScan/`). Making the items in the drop down menu can be done in this way: `def list = ['ls', "/path/to/dirToScan/"].execute().text.tokenize()` To reach the right directory, I need the name of the job since, as opposed to when a job is executed, the directory in which the this is done is not the `/var/lib/jenkins/workspace/[Job Name]/` directory but the root dir `/`. The Dynamic Choice Parameter plugin allows the execution of a Groovy script to fill the choice parameter. Using the answer provided [here|http://stackoverflow.com/a/28745606] I was able to retrieve the job name. So my final code to build the drop-down menu in the parameterized build menu in Jenkins looks like this: {quote} def build = Thread.currentThread().toString() def regexp= ".+?/job/([^/]+)/.*" def match = build =~ regexp def jobName = match[0][1] def list = ['ls', "/var/lib/jenkins/workspace/" << jobName << "/dirToScan"].execute().text.tokenize() {quote} Clicking the Build with Parameters link in the Jenkins job opens the page with the drop-down menu (which I named Restore) and also the actual building works great! But now comes my problem: If set the job to be build periodically, the build fails with the following console output: {quote} Started by timer Building in workspace /var/lib/jenkins/workspace/JobName FATAL: Null value not allowed as an environment variable: Restore java.lang.IllegalArgumentException: Null value not allowed as an environment variable: Restore at hudson.EnvVars.put(EnvVars.java:356) at hudson.model.StringParameterValue.buildEnvironment(StringParameterValue.java:56) at hudson.model.ParametersAction.buildEnvVars(ParametersAction.java:88) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:929) at hudson.plugins.mercurial.MercurialSCM.checkout(MercurialSCM.java:533) at hudson.scm.SCM.checkout(SCM.java:484) at hudson.model.AbstractProject.checkout(AbstractProject.java:1270) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:609) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:531) at hudson.model.Run.execute(Run.java:1750) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:89) at hudson.model.Executor.run(Executor.java:240) Finished: FAILURE {quote} This does not happen if I just populate the drop-down menu in a 'normal' way, e.g.: def list = ["Option 1", "Option 2", "Option 3"] This might be a bug in the plugin, or Jenkins being unable to execute the Groovy code if it starts a job by itself. The problem only occurs with a periodic build, not if I start the build myself and it it independent of the chosen option in the drop-down menu.

    Jenkins JIRA | 2 years ago | Chiel de Koningh
    java.lang.IllegalArgumentException: Null value not allowed as an environment variable: Restore
  6. 0

    I'm trying to use the Dynamic Choice Parameter plugin to set up a parameterized build in Jenkins. The parameters should be the names of some directory's in a directory of the working directory of the job (i.e. `/var/lib/jenkins/workspace/JobName/dirToScan/`). Making the items in the drop down menu can be done in this way: `def list = ['ls', "/path/to/dirToScan/"].execute().text.tokenize()` To reach the right directory, I need the name of the job since, as opposed to when a job is executed, the directory in which the this is done is not the `/var/lib/jenkins/workspace/[Job Name]/` directory but the root dir `/`. The Dynamic Choice Parameter plugin allows the execution of a Groovy script to fill the choice parameter. Using the answer provided [here|http://stackoverflow.com/a/28745606] I was able to retrieve the job name. So my final code to build the drop-down menu in the parameterized build menu in Jenkins looks like this: {quote} def build = Thread.currentThread().toString() def regexp= ".+?/job/([^/]+)/.*" def match = build =~ regexp def jobName = match[0][1] def list = ['ls', "/var/lib/jenkins/workspace/" << jobName << "/dirToScan"].execute().text.tokenize() {quote} Clicking the Build with Parameters link in the Jenkins job opens the page with the drop-down menu (which I named Restore) and also the actual building works great! But now comes my problem: If set the job to be build periodically, the build fails with the following console output: {quote} Started by timer Building in workspace /var/lib/jenkins/workspace/JobName FATAL: Null value not allowed as an environment variable: Restore java.lang.IllegalArgumentException: Null value not allowed as an environment variable: Restore at hudson.EnvVars.put(EnvVars.java:356) at hudson.model.StringParameterValue.buildEnvironment(StringParameterValue.java:56) at hudson.model.ParametersAction.buildEnvVars(ParametersAction.java:88) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:929) at hudson.plugins.mercurial.MercurialSCM.checkout(MercurialSCM.java:533) at hudson.scm.SCM.checkout(SCM.java:484) at hudson.model.AbstractProject.checkout(AbstractProject.java:1270) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:609) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:531) at hudson.model.Run.execute(Run.java:1750) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:89) at hudson.model.Executor.run(Executor.java:240) Finished: FAILURE {quote} This does not happen if I just populate the drop-down menu in a 'normal' way, e.g.: def list = ["Option 1", "Option 2", "Option 3"] This might be a bug in the plugin, or Jenkins being unable to execute the Groovy code if it starts a job by itself. The problem only occurs with a periodic build, not if I start the build myself and it it independent of the chosen option in the drop-down menu.

    Jenkins JIRA | 2 years ago | Chiel de Koningh
    java.lang.IllegalArgumentException: Null value not allowed as an environment variable: Restore

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Null value not allowed as an environment variable: VARIABLE_NAME

      at hudson.EnvVars.put()
    2. Hudson
      AbstractBuild.getEnvironment
      1. hudson.EnvVars.put(EnvVars.java:356)
      2. hudson.model.StringParameterValue.buildEnvironment(StringParameterValue.java:56)
      3. hudson.model.ParametersAction.buildEnvVars(ParametersAction.java:85)
      4. hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:883)
      4 frames
    3. Hudson Parameterized Trigger plugin
      AbstractBuildParameters.getEnvironment
      1. hudson.plugins.parameterizedtrigger.AbstractBuildParameters.getEnvironment(AbstractBuildParameters.java:47)
      1 frame
    4. org.jenkinsci.plugins
      GeneratorRun$GeneratorImpl.doRun
      1. org.jenkinsci.plugins.jobgenerator.parameterizedtrigger.PredefinedGeneratorParameters.getAction(PredefinedGeneratorParameters.java:59)
      2. org.jenkinsci.plugins.jobgenerator.GeneratorRun$GeneratorImpl.gatherDownstreamGenerators(GeneratorRun.java:493)
      3. org.jenkinsci.plugins.jobgenerator.GeneratorRun$GeneratorImpl.doRun(GeneratorRun.java:299)
      3 frames
    5. Hudson
      Run.execute
      1. hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:523)
      2. hudson.model.Run.execute(Run.java:1688)
      2 frames
    6. org.jenkinsci.plugins
      GeneratorRun.run
      1. org.jenkinsci.plugins.jobgenerator.GeneratorRun.run(GeneratorRun.java:284)
      1 frame
    7. Hudson
      OneOffExecutor.run
      1. hudson.model.ResourceController.execute(ResourceController.java:88)
      2. hudson.model.Executor.run(Executor.java:231)
      3. hudson.model.OneOffExecutor.run(OneOffExecutor.java:43)
      3 frames