-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Linux
-
Powered by SuggestiMate
We have a global custom ivy settings file that is used by the Jenkins jobs, that are using Ivy build trigger to run. Due to the StackOverflowError we are trying to find a path to migrate all jobs from being free-style to ivy jobs.
The ivy settings file includes another file specific to the java version basing on the env variable JAVA_VERSION (named like extended.settings-${ENV.JAVA_VERSION})
On master node this resolves properly and parsing ivy descriptors step works properly. But the same exact build fails if running on a slave.
I tried to inject all sorts of variables using envInject plugin but it gives me the error all the time:
Error while reading the default Ivy2.1 settings: failed to load settings from file "our_global_ivy_settings_file".xml: io problem while parsing config file "extended.settings-${ENV.JAVA_VERSION}.xml"
Note that the variable in the file name was not expanded properly.
[JENKINS-15779] Parsing ivy descriptors step fails on a slave when custom ivy settings file is used
your compilation workaround works! As for the main issue:
On the master the build works fine. On the slave it fails with the exception below. Same code, same project, same settings:
... Parsing Ivy Descriptor Files ERROR: Failed to parse ivy.xml files java.io.IOException : Remote call on <hostname> failed at hudson.remoting.Channel.call(Channel.java:673) at hudson.FilePath.act(FilePath.java:939) at hudson.ivy.IvyModuleSetBuild$RunnerImpl.parseIvyDescriptorFiles(IvyModuleSetBuild.java:523) at hudson.ivy.IvyModuleSetBuild$RunnerImpl.doRun(IvyModuleSetBuild.java:365) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:589) at hudson.model.Run.execute(Run.java:1516) at hudson.model.Run.run(Run.java:1462) at hudson.ivy.IvyModuleSetBuild.run(IvyModuleSetBuild.java:281) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:236) Caused by:java.lang.ExceptionInInitializerError at hudson.ivy.IvyModuleSetBuild$IvyXmlParser.getIvySettingsFile(IvyModuleSetBuild.java:893) at hudson.ivy.IvyModuleSetBuild$IvyXmlParser.getIvy(IvyModuleSetBuild.java:829) at hudson.ivy.IvyModuleSetBuild$IvyXmlParser.call(IvyModuleSetBuild.java:778) at hudson.ivy.IvyModuleSetBuild$IvyXmlParser.call(IvyModuleSetBuild.java:741) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by:java.lang.NullPointerException at hudson.model.Descriptor.getConfigFile(Descriptor.java:786) at hudson.model.Descriptor.load(Descriptor.java:774) at hudson.ivy.IvyModuleSet$DescriptorImpl.<init>(IvyModuleSet.java:769) at hudson.ivy.IvyModuleSet.<clinit>(IvyModuleSet.java:757) ... 13 more
Code changed in jenkins
User: johnou
Path:
src/main/java/hudson/ivy/IvyModuleSetBuild.java
http://jenkins-ci.org/commit/ivy-plugin/d7e77eec8959b70afc44e94bb38468ac8aca46d2
Log:
JENKINS-15779: Parsing ivy descriptors step fails on a slave when custom ivy settings file is used.
I am feeling good about this snapshot ( https://issues.jenkins-ci.org/secure/attachment/23081/ivy.hpi ).. Patch available at https://github.com/jenkinsci/ivy-plugin/commit/d7e77eec8959b70afc44e94bb38468ac8aca46d2.patch (do not apply the patch from JENKINS-15774).
I applied the patch to the current master and assembled the plugin - it works when running on master and fails on a slave with NPE
Parsing Ivy Descriptor Files Error while reading the default Ivy 2.1 settings: failed to load settings from file:../custom.ivy.settings.xml: io problem while parsing config file: ../custom.ivy.settings-${ENV.JAVA_VERSION}.xml [Ljava.lang.StackTraceElement;@10a6bf3 ERROR: Failed to parse ivy.xml files java.io.IOException: Unable to parse ivy descriptors at hudson.ivy.IvyModuleSetBuild$RunnerImpl.parseIvyDescriptorFiles(IvyModuleSetBuild.java:530) at hudson.ivy.IvyModuleSetBuild$RunnerImpl.doRun(IvyModuleSetBuild.java:366) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:589) at hudson.model.Run.execute(Run.java:1516) at hudson.model.Run.run(Run.java:1462) at hudson.ivy.IvyModuleSetBuild.run(IvyModuleSetBuild.java:282) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:236) Caused by: java.lang.NullPointerException at hudson.ivy.IvyModuleSetBuild$IvyXmlParser.call(IvyModuleSetBuild.java:793) at hudson.ivy.IvyModuleSetBuild$IvyXmlParser.call(IvyModuleSetBuild.java:742) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)
Where is custom.ivy.settings-${ENV.JAVA_VERSION}.xml defined? Have you set it in "Ivy settings property files"?
it seems we got to the root of the problem:
Before the actual build starts Jenkins attempts to parse the ivy descriptors in order to determine which ivy modules are supposed to be built. This step doesn't exist when ivy build trigger is used, only when the ivy type job is used. This step is failing to parse ivy descriptors when running on slave as the environment variables are not passed to the slave from master. More than that - this step is not needed unless the build is specified to be incremental or the build is having modules as separate jobs.
It works on master because we are specifying a default value for the JAVA_VERSION property in jenkins startup script. Interestingly enough injecting this variable into the build or slave configuration (Node proeprties) doesn't help, so it keeps failing on the slave.
Therefore the issue is now broken to two parts:
1. The parsing descriptors step should not be executed if the build doesn't require it (that should solve our problem as we are not using neither incremental or separate module-job kind of builds) For that latest changes are provided here:
https://github.com/jenkinsci/ivy-plugin/tree/ivy-descriptors
2. It still open question how to make this parsing step to work on a slave with this kind of variables in case of incremental build or separate module-jobs
I can now confirm that the build is not failing anymore on the slave as the parsing step was removed for builds not using the modules. The build still fails with the same exception if "build modules as separate jobs" or "incremental build" is selected.
https://github.com/jenkinsci/ivy-plugin/compare/ivy-descriptors is the more useful link by the way.
Note that the variable in the file name was not expanded properly.
Looks like it is the root of the issue: environment variables are not passed to slave.
As it was explained in this perfect comment it appears that Jenkins "Environment Variables" are not in fact environment variables - they should be called "Custom Jenkins Slave Parameters".
As you could see here there is no variable called JAVA_VERSION among these so called "Environment Variables" (though they are not environment variables).
So in order to get this fixed, you should define JAVA_VERSION variable using EnvInject plugin to get it injected into slave environment.
See also related issues at StackOverflow:
http://stackoverflow.com/questions/5818403/jenkins-hudson-environment-variables
http://stackoverflow.com/questions/10625259/how-to-set-environment-variables-in-jenkins
I guess it should fix the issue.
Let me know if it does not.
Would you please try the latest snapshot ( https://issues.jenkins-ci.org/secure/attachment/23055/ivy.hpi ). I have added logging to spit out the Java home and changed IvyXmlParser to load EnvVars. Changeset available at https://github.com/jenkinsci/ivy-plugin/commit/cdf08c9adde721f5ad93b9d0e79f4c0c013c4e0d.patch