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

Environment variables from EnvInject plugin are not inherited/parsed by batch tasks

      Environment variables set for a job with the "Prepare an environment for the run" and not processed/used for batch tasks. This is very similar to bug JENKINS-5580 reported for batch tasks and the now deprecated setenv plugin

          [JENKINS-13647] Environment variables from EnvInject plugin are not inherited/parsed by batch tasks

          Well, I don't know since downgrading batch-task is fixing the issue, even if it's the rebuild-plugin which throws the exception. I'm not sure to understand why the rebuild-plugin is called when executing a batch task, but if it was already called before that change, then its "current project" wasn't null...
          Do you think the use of EnvInject in batch-task requires some upgrade on rebuild-plugin? Isn't there a broken backward compatibility which could be fixed in EnvInject?

          Julien Carsique added a comment - Well, I don't know since downgrading batch-task is fixing the issue, even if it's the rebuild-plugin which throws the exception. I'm not sure to understand why the rebuild-plugin is called when executing a batch task, but if it was already called before that change, then its "current project" wasn't null... Do you think the use of EnvInject in batch-task requires some upgrade on rebuild-plugin? Isn't there a broken backward compatibility which could be fixed in EnvInject?

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/com/sonyericsson/rebuild/RebuildAction.java
          http://jenkins-ci.org/commit/rebuild-plugin/1b940ee344354bef8f8a1629c219dd453e2c903c
          Log:
          Fix for JENKINS-13647
          Avoid NullPointerException on the getProject() method when getURL() method is call from a content where your can't retrieve a Project object in the request (such as in the batch-task plugin)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/com/sonyericsson/rebuild/RebuildAction.java http://jenkins-ci.org/commit/rebuild-plugin/1b940ee344354bef8f8a1629c219dd453e2c903c Log: Fix for JENKINS-13647 Avoid NullPointerException on the getProject() method when getURL() method is call from a content where your can't retrieve a Project object in the request (such as in the batch-task plugin)

          Fixed.
          The error was not due to the EnvInject plugin.
          EnvInject plugin only participates to have an isolate build by managing environment variables.
          The Batch-Task plugin delegates environment variables to the EnvInject library. The library is embedded in the batch-task plugin distribution (the installation of the EnvInject plugin is not required).
          EnvInject library calls programmatically all build actions. In your use case, these actions contained an action from the rebuild plugin.
          And RebuildAction object threw an exception when the project object can't be retrieve from the request (the use case in the batch-task plugin context).
          I fixed it in the rebuild plugin.
          Please upgrade to rebuild plugin 1.11.

          Gregory Boissinot added a comment - Fixed. The error was not due to the EnvInject plugin. EnvInject plugin only participates to have an isolate build by managing environment variables. The Batch-Task plugin delegates environment variables to the EnvInject library. The library is embedded in the batch-task plugin distribution (the installation of the EnvInject plugin is not required). EnvInject library calls programmatically all build actions. In your use case, these actions contained an action from the rebuild plugin. And RebuildAction object threw an exception when the project object can't be retrieve from the request (the use case in the batch-task plugin context). I fixed it in the rebuild plugin. Please upgrade to rebuild plugin 1.11.

          Still got the issue with Jenkins 1.465, batch task plugin 1.16, rebuild plugin 1.11:

          hudson.model.Executor run
          SEVERE: Executor threw an exception
          java.lang.NullPointerException: Current Project is null
                  at com.sonyericsson.rebuild.RebuildAction.getProject(RebuildAction.java:121)
                  at com.sonyericsson.rebuild.RebuildAction.getUrlName(RebuildAction.java:153)
                  at org.jenkinsci.lib.envinject.service.EnvInjectActionRetriever.getEnvInjectAction(EnvInjectActionRetriever.java:32)
                  at org.jenkinsci.lib.envinject.service.EnvVarsResolver.getEnVars(EnvVarsResolver.java:51)
                  at hudson.plugins.batch_task.BatchRun.run(BatchRun.java:224)
                  at hudson.model.ResourceController.execute(ResourceController.java:88)
                  at hudson.model.Executor.run(Executor.java:239)
          

          Julien Carsique added a comment - Still got the issue with Jenkins 1.465, batch task plugin 1.16, rebuild plugin 1.11: hudson.model.Executor run SEVERE: Executor threw an exception java.lang.NullPointerException: Current Project is null at com.sonyericsson.rebuild.RebuildAction.getProject(RebuildAction.java:121) at com.sonyericsson.rebuild.RebuildAction.getUrlName(RebuildAction.java:153) at org.jenkinsci.lib.envinject.service.EnvInjectActionRetriever.getEnvInjectAction(EnvInjectActionRetriever.java:32) at org.jenkinsci.lib.envinject.service.EnvVarsResolver.getEnVars(EnvVarsResolver.java:51) at hudson.plugins.batch_task.BatchRun.run(BatchRun.java:224) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:239)

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/com/sonyericsson/rebuild/RebuildAction.java
          http://jenkins-ci.org/commit/rebuild-plugin/82498435502a5529998a0859d24ed6a14a53e992
          Log:
          Fix for JENKINS-13647
          Rewrite getURL() to fix a NullPointerException

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/com/sonyericsson/rebuild/RebuildAction.java http://jenkins-ci.org/commit/rebuild-plugin/82498435502a5529998a0859d24ed6a14a53e992 Log: Fix for JENKINS-13647 Rewrite getURL() to fix a NullPointerException

          Julien Carsique added a comment - - edited

          Reproduced again with Jenkins 1.472, Batch task 1.16 and Rebuilder 1.14:

          Jul 27, 2012 9:16:25 AM hudson.model.Executor run
          SEVERE: Executor threw an exception
          java.lang.NullPointerException: Current Project is null
                  at com.sonyericsson.rebuild.RebuildAction.getProject(RebuildAction.java:129)
                  at com.sonyericsson.rebuild.RebuildAction.isRebuildAvailable(RebuildAction.java:227)
                  at com.sonyericsson.rebuild.RebuildAction.getUrlName(RebuildAction.java:154)
                  at org.jenkinsci.lib.envinject.service.EnvInjectActionRetriever.getEnvInjectAction(EnvInjectActionRetriever.java:32)
                  at org.jenkinsci.lib.envinject.service.EnvVarsResolver.getEnVars(EnvVarsResolver.java:51)
                  at hudson.plugins.batch_task.BatchRun.run(BatchRun.java:224)
                  at hudson.model.ResourceController.execute(ResourceController.java:88)
                  at hudson.model.Executor.run(Executor.java:236)
          

          Downgrading again to Batch task 1.15 as a workaround.

          Julien Carsique added a comment - - edited Reproduced again with Jenkins 1.472, Batch task 1.16 and Rebuilder 1.14: Jul 27, 2012 9:16:25 AM hudson.model.Executor run SEVERE: Executor threw an exception java.lang.NullPointerException: Current Project is null at com.sonyericsson.rebuild.RebuildAction.getProject(RebuildAction.java:129) at com.sonyericsson.rebuild.RebuildAction.isRebuildAvailable(RebuildAction.java:227) at com.sonyericsson.rebuild.RebuildAction.getUrlName(RebuildAction.java:154) at org.jenkinsci.lib.envinject.service.EnvInjectActionRetriever.getEnvInjectAction(EnvInjectActionRetriever.java:32) at org.jenkinsci.lib.envinject.service.EnvVarsResolver.getEnVars(EnvVarsResolver.java:51) at hudson.plugins.batch_task.BatchRun.run(BatchRun.java:224) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:236) Downgrading again to Batch task 1.15 as a workaround.

          kalpesh soni added a comment - - edited

          I dont think I use rebuilder

          mine is

          Feb 20, 2013 2:28:54 PM hudson.model.Executor run
          SEVERE: Executor threw an exception
          java.lang.NullPointerException
          	at org.jenkinsci.lib.envinject.service.EnvInjectActionRetriever.getEnvInjectAction(EnvInjectActionRetriever.java:32)
          	at org.jenkinsci.lib.envinject.service.EnvVarsResolver.getEnVars(EnvVarsResolver.java:51)
          	at hudson.plugins.batch_task.BatchRun.run(BatchRun.java:224)
          	at hudson.model.ResourceController.execute(ResourceController.java:88)
          	at hudson.model.Executor.run(Executor.java:236)
          

          latest jenkins 1.499 batch task 1.16

          kalpesh soni added a comment - - edited I dont think I use rebuilder mine is Feb 20, 2013 2:28:54 PM hudson.model.Executor run SEVERE: Executor threw an exception java.lang.NullPointerException at org.jenkinsci.lib.envinject.service.EnvInjectActionRetriever.getEnvInjectAction(EnvInjectActionRetriever.java:32) at org.jenkinsci.lib.envinject.service.EnvVarsResolver.getEnVars(EnvVarsResolver.java:51) at hudson.plugins.batch_task.BatchRun.run(BatchRun.java:224) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:236) latest jenkins 1.499 batch task 1.16

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          pom.xml
          http://jenkins-ci.org/commit/batch-task-plugin/0ebcd0b025c5f85ac9addc530cf21da8d72c2b99
          Log:
          Fix JENKINS-13647


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: pom.xml http://jenkins-ci.org/commit/batch-task-plugin/0ebcd0b025c5f85ac9addc530cf21da8d72c2b99 Log: Fix JENKINS-13647 – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

          There is an issue for recent Jenkins core version.

          Gregory Boissinot added a comment - There is an issue for recent Jenkins core version.

          basharimovvv added a comment -

          Jenkins ver. 1.515
          Environment Injector Plugin 1.86
          Jenkins batch task plugin 1.17

          Build describes env vars on "Prepare an environment for the run". There is injectedEnvVars.txt and there is the env var there. But run of batch task does not load them.

          basharimovvv added a comment - Jenkins ver. 1.515 Environment Injector Plugin 1.86 Jenkins batch task plugin 1.17 Build describes env vars on "Prepare an environment for the run". There is injectedEnvVars.txt and there is the env var there. But run of batch task does not load them.

            gbois Gregory Boissinot
            tsondergaard tsondergaard
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: