-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Powered by SuggestiMate
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
Note that in the attached config.xml the environment variables (EVVERSION among others) are manually duplicated in the make-release batch task (to make it work)
Code changed in jenkins
User: Gregory Boissinot
Path:
pom.xml
src/main/java/hudson/plugins/batch_task/BatchRun.java
http://jenkins-ci.org/commit/batch-task-plugin/69b3bde996d5500b18c69f582c7c14e5d1ef9fe4
Log:
Fix JENKINS-13647
The use of EnvVarsResolver in that commit seems to cause a blocker issue when running a batch task. Nothing happens on the GUI, the console is empty, here's the server log stacktrace:
hudson.model.Executor run
SEVERE: Executor threw an exception
java.lang.NullPointerException: Current Project is null
at com.sonyericsson.rebuild.RebuildAction.getProject(RebuildAction.java:117)
at com.sonyericsson.rebuild.RebuildAction.getUrlName(RebuildAction.java:144)
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)
Tested with Jenkins 1.460 and 1.463
According to the trace, it is due to the rebuild Jenkins Plugin
AbstractProject currentProject = null; StaplerRequest request = Stapler.getCurrentRequest(); if (request != null) { currentProject = request.findAncestorObject(AbstractProject.class); } if (currentProject == null) { throw new NullPointerException("Current Project is null"); }
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)
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)
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
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.
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.
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.
Could you attach your job configuration file (config.xml)?