Failed to install plugins using a docker image
Using the 0.7-alpha docker image i am getting this error message saying download failed. @oleg-nenashev thinks something else is going on.
jenkins_1 | hudson.util.HudsonFailedToLoad: org.jvnet.hudson.reactor.ReactorException: java.lang.Error: java.lang.reflect.InvocationTargetException
jenkins_1 | at hudson.WebAppMain$3.run(WebAppMain.java:250)
jenkins_1 | Caused by: org.jvnet.hudson.reactor.ReactorException: java.lang.Error: java.lang.reflect.InvocationTargetException
jenkins_1 | at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:282)
jenkins_1 | at jenkins.InitReactorRunner.run(InitReactorRunner.java:48)
jenkins_1 | at jenkins.model.Jenkins.executeReactor(Jenkins.java:1098)
jenkins_1 | at jenkins.model.Jenkins.<init>(Jenkins.java:900)
jenkins_1 | at hudson.model.Hudson.<init>(Hudson.java:85)
jenkins_1 | at hudson.model.Hudson.<init>(Hudson.java:81)
jenkins_1 | at hudson.WebAppMain$3.run(WebAppMain.java:233)
jenkins_1 | Caused by: java.lang.Error: java.lang.reflect.InvocationTargetException
jenkins_1 | at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110)
jenkins_1 | at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
jenkins_1 | at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
jenkins_1 | at jenkins.model.Jenkins$5.runTask(Jenkins.java:1064)
jenkins_1 | at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
jenkins_1 | at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
jenkins_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
jenkins_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
jenkins_1 | at java.lang.Thread.run(Thread.java:748)
jenkins_1 | Caused by: java.lang.reflect.InvocationTargetException
jenkins_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
jenkins_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
jenkins_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
jenkins_1 | at java.lang.reflect.Method.invoke(Method.java:498)
jenkins_1 | at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
jenkins_1 | ... 8 more
jenkins_1 | Caused by: org.jenkinsci.plugins.casc.ConfiguratorException: plugins: error configuring <plugins> with <plugins> configurator
jenkins_1 | at org.jenkinsci.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:346)
jenkins_1 | at org.jenkinsci.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:280)
jenkins_1 | at org.jenkinsci.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:253)
jenkins_1 | at org.jenkinsci.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:156)
jenkins_1 | at org.jenkinsci.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:135)
jenkins_1 | ... 13 more
jenkins_1 | Caused by: org.jenkinsci.plugins.casc.ConfiguratorException: Failed to download plugin git:3.8.0
jenkins_1 | at org.jenkinsci.plugins.casc.plugins.PluginManagerConfigurator.configure(PluginManagerConfigurator.java:193)
jenkins_1 | at org.jenkinsci.plugins.casc.plugins.PluginManagerConfigurator.configure(PluginManagerConfigurator.java:49)
jenkins_1 | at org.jenkinsci.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:340)
jenkins_1 | ... 17 more
jenkins_1 | Caused by: java.io.IOException: Failed to dynamically deploy this plugin
jenkins_1 | at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1893)
jenkins_1 | at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1651)
jenkins_1 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
jenkins_1 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
jenkins_1 | at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:112)
jenkins_1 | ... 1 more
jenkins_1 | Caused by: java.util.zip.ZipException: error in opening zip file
jenkins_1 | at java.util.zip.ZipFile.open(Native Method)
jenkins_1 | at java.util.zip.ZipFile.<init>(ZipFile.java:225)
jenkins_1 | at java.util.zip.ZipFile.<init>(ZipFile.java:155)
jenkins_1 | at java.util.jar.JarFile.<init>(JarFile.java:166)
jenkins_1 | at java.util.jar.JarFile.<init>(JarFile.java:145)
jenkins_1 | at hudson.ClassicPluginStrategy.getShortName(ClassicPluginStrategy.java:116)
jenkins_1 | at hudson.PluginManager.dynamicLoad(PluginManager.java:835)
jenkins_1 | at hudson.PluginManager.dynamicLoad(PluginManager.java:822)
jenkins_1 | at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1889)
jenkins_1 | ... 5 more
Yaml for this instance:
jenkins:
systemMessage: "Welcome to the demo setup for Jenkins Configuration as Code plugin"
tool:
git:
installations:
- name: Default
home: "git"
plugins:
required:
git: 3.8.0
Created https://issues.jenkins-ci.org/browse/JENKINS-51608
Right i've done some further research on this. Simply put, the current install plugins feature does not work. I've narrowed down the issue to the following.
When we construct the metadata to install a specific version we deliberately add an empty json list to dependencies
https://github.com/jenkinsci/configuration-as-code-plugin/blob/b3c7ec51247a20db658c7a02c23384f7837fb6ca/src/main/java/org/jenkinsci/plugins/casc/plugins/PluginManagerConfigurator.java#L157-L167
What this means, is that this line: final UpdateCenter.UpdateCenterJob job = installable.deploy(true).get(); will always fail throw an exception if the plugins section contains a plugin which has depencies that are not already installed. This happens before our plugin get's a chance to install dependant plugins to construct the shrinkwrap. Problem is, that this inspection of the downloaded .jpi file happens after the deploy step, which we never get to because it failed deploying the plugin dynamically.
I've managed to get it to work if you deliberately do not let it deploy dynamically, which also means we always have to restart when the plugin list is updated.
@ndeloof and @oleg-nenashev is there a right way to detect that a plugin failed to dynamically deploy? I know we get an IOExecption, bit it would be nice if we could somehow do it like this and had a check on UpdateCenter.DownloadJob.DownloadSuccesFailDeployDynamic or MissingPlugins:
if (job.getError() != null) {
if (job.getError() instanceof UpdateCenter.DownloadJob.SuccessButRequiresRestart) {
requireRestart = true;
} else {
throw job.getError();
}
}
Also...i can't get the syntaxt with break install; to work, the only way i could get it to continue evaluating was with continue install;....I've never used java loop/labels before.
I think we should just not support dynamic installation. I enabled this when trying to implement a test case, sounds we should just give up fighting for now. Please remember this approach is a temporary workaround until Update Center do expose metadata about all versions of hosted plugins, not just latest (see https://github.com/jenkins-infra/update-center2/pull/198)
Better diagnostics would be nice anyway
@ndeloof Yeah i think we should disable it for now. Do you have any idea about the break/continue label thing? The break to-label does not work, it simply does not continue the while loop even if there are more elements.
@oleg-nenashev Yeah i'm creating a pull request for this, that has the dynamic deploy disabled for now and a LOT more info printouts in console. It took me a while to actually figure out what was going on. I'll make it so that we inform the user when a plugin is being installed, and dependant plugins are detected.
you're perfectly right we need continue install. Seems I tested with trivial scenarios only.
I wonder we could rely on hudson.model.UpdateCenter.DownloadJob to get a plugin downloaded but not activated, so we can collect dependencies, then enable (hudson.model.UpdateCenter.EnableJob) all plugins we installed in reverse order.
Maybe too complex to be implemented as a real solution should come with actual metadata hosted by Update Center