Status: Resolved (View Workflow)
java -jar jenkins-cli.jar -s http://localhost:8080/ install-plugin http://updates.jenkins-ci.org/latest/job-dsl.hpi
Installing a plugin from http://updates.jenkins-ci.org/latest/job-dsl.hpi
but fails to install the plugin
java -jar jenkins-cli.jar -s http://localhost:8080/ list-plugins
doesn't list it, neither does the GUI
curl -X POST -d '<jenkins><install plugin="firstname.lastname@example.org" /></jenkins>' --header 'Content-Type: text/xml' http://localhost:8080/pluginManager/installNecessaryPlugins
does install the plugin
As of https://github.com/jenkinsci/jenkins/pull/4123 the silent corruption is replaced by an error (and no bogus file except for a *.tmp):
Installing a plugin from https://updates.jenkins.io/download/plugins/groovy/2.2/groovy.hpi ERROR: Unexpected exception occurred while performing install-plugin command. java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:225) at java.util.zip.ZipFile.<init>(ZipFile.java:155) at java.util.jar.JarFile.<init>(JarFile.java:166) at java.util.jar.JarFile.<init>(JarFile.java:130) at hudson.cli.InstallPluginCommand.moveToFinalLocation(InstallPluginCommand.java:176) at hudson.cli.InstallPluginCommand.run(InstallPluginCommand.java:110) at …
Making it follow redirects would be a nice enhancement.
Not sure I would consider this “fixed”, exactly—Jenkins still does not follow redirects—but the behavior is certainly better than before.
The part where Jenkins comes up with failures to load (potentially many) plugins is fixed; so seems reasonable to me to close this. What's left is the lack of supporting HTTP redirects, which can be filed in a new issue if desired.
danielbeck Maybe this could be reopen. Or maybe this is related to https://issues.jenkins-ci.org/browse/JENKINS-44361 ? The issue with the HTTP / HTTPS redirect is corrupting the file when downloading using the CLI.
If I use wget https://updates.jenkins.io/download/plugins/groovy/2.2/groovy.hpi and then do a sha1sum groovy.jpi I can see the right sha 85af4e8de47e981d3bf22adaf0c7f5747b991d83.
If I use the Jenkins CLI to install from https://updates.jenkins.io, it succeeds:
but the sha of the $JENKINS_HOME/plugins/groovy.hpi is wrong 7c5e3f4ae6540474cf24bd4cb3ece2d31e701965. The file contains the HTTP response:
This will break Jenkins startup on the next restart.
If I use the Jenkins CLI to install from http://updates.jenkins.io, it succeeds:
And the sha of the $JENKINS_HOME/plugins/groovy.hpi is correct 85af4e8de47e981d3bf22adaf0c7f5747b991d83*
Note that it works for the update site at jenkins-updates.cloudbees.com/ whether you use http or https