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

CLI install plugin jobs-dsl fails

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Fixed
    • cli
    • None
    • Jenkins 2.189

    Description

      java -jar jenkins-cli.jar -s http://localhost:8080/ install-plugin http://updates.jenkins-ci.org/latest/job-dsl.hpi

      reports

      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="job-dsl@1.34" /></jenkins>' --header 'Content-Type: text/xml' http://localhost:8080/pluginManager/installNecessaryPlugins

      does install the plugin

      Attachments

        Activity

          allan_burdajewicz Allan BURDAJEWICZ added a comment - - edited

          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:

          java -jar jenkins-cli.jar -logger FINE -s http://cje.example.com:8081 -auth admin:admin install-plugin https://updates.jenkins.io/download/plugins/groovy/2.2/groovy.hpi 
          Jul 19, 2019 2:34:09 PM org.apache.sshd.common.util.security.SecurityUtils register
          FINE: register(BC) not registered - enabled=true, supported=false
          Jul 19, 2019 2:34:09 PM org.apache.sshd.common.util.security.AbstractSecurityProviderRegistrar getOrCreateProvider
          INFO: getOrCreateProvider(EdDSA) created instance of net.i2p.crypto.eddsa.EdDSASecurityProvider
          Jul 19, 2019 2:34:09 PM hudson.cli.CLI _main
          FINE: using connection mode HTTP
          Jul 19, 2019 2:34:09 PM hudson.cli.CLI plainHttpConnection
          FINE: Trying to connect to http://allan.oss.com:8081/ via plain protocol over HTTP
          Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init>
          FINE: establishing download side
          Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init>
          FINE: established download side
          Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init>
          FINE: establishing upload side
          Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init>
          FINE: established upload side
          Installing a plugin from https://updates.jenkins.io/download/plugins/groovy/2.2/groovy.hpi
          

          but the sha of the $JENKINS_HOME/plugins/groovy.hpi is wrong 7c5e3f4ae6540474cf24bd4cb3ece2d31e701965. The file contains the HTTP response:

          <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
          <html><head>
          <title>302 Found</title>
          </head><body>
          <h1>Found</h1>
          <p>The document has moved <a href="http://mirrors.jenkins-ci.org/plugins/groovy/2.2/groovy.hpi">here</a>.</p>
          </body></html>
          

          This will break Jenkins startup on the next restart.

          If I use the Jenkins CLI to install from http://updates.jenkins.io, it succeeds:

          java -jar jenkins-cli.jar -logger FINE -s http://cje.example.com:8081 -auth admin:admin install-plugin https://updates.jenkins.io/download/plugins/groovy/2.2/groovy.hpi 
          Jul 19, 2019 2:34:09 PM org.apache.sshd.common.util.security.SecurityUtils register
          FINE: register(BC) not registered - enabled=true, supported=false
          Jul 19, 2019 2:34:09 PM org.apache.sshd.common.util.security.AbstractSecurityProviderRegistrar getOrCreateProvider
          INFO: getOrCreateProvider(EdDSA) created instance of net.i2p.crypto.eddsa.EdDSASecurityProvider
          Jul 19, 2019 2:34:09 PM hudson.cli.CLI _main
          FINE: using connection mode HTTP
          Jul 19, 2019 2:34:09 PM hudson.cli.CLI plainHttpConnection
          FINE: Trying to connect to http://allan.oss.com:8081/ via plain protocol over HTTP
          Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init>
          FINE: establishing download side
          Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init>
          FINE: established download side
          Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init>
          FINE: establishing upload side
          Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init>
          FINE: established upload side
          Installing a plugin from https://updates.jenkins.io/download/plugins/groovy/2.2/groovy.hpi
          

          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

          allan_burdajewicz Allan BURDAJEWICZ added a comment - - edited 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: java -jar jenkins-cli.jar -logger FINE -s http: //cje.example.com:8081 -auth admin:admin install-plugin https://updates.jenkins.io/download/plugins/groovy/2.2/groovy.hpi Jul 19, 2019 2:34:09 PM org.apache.sshd.common.util.security.SecurityUtils register FINE: register(BC) not registered - enabled= true , supported= false Jul 19, 2019 2:34:09 PM org.apache.sshd.common.util.security.AbstractSecurityProviderRegistrar getOrCreateProvider INFO: getOrCreateProvider(EdDSA) created instance of net.i2p.crypto.eddsa.EdDSASecurityProvider Jul 19, 2019 2:34:09 PM hudson.cli.CLI _main FINE: using connection mode HTTP Jul 19, 2019 2:34:09 PM hudson.cli.CLI plainHttpConnection FINE: Trying to connect to http: //allan.oss.com:8081/ via plain protocol over HTTP Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init> FINE: establishing download side Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init> FINE: established download side Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init> FINE: establishing upload side Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init> FINE: established upload side Installing a plugin from https: //updates.jenkins.io/download/plugins/groovy/2.2/groovy.hpi but the sha of the $JENKINS_HOME/plugins/groovy.hpi is wrong 7c5e3f4ae6540474cf24bd4cb3ece2d31e701965 . The file contains the HTTP response: <!DOCTYPE HTML PUBLIC "- //IETF//DTD HTML 2.0//EN" > <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href= "http: //mirrors.jenkins-ci.org/plugins/groovy/2.2/groovy.hpi" >here</a>.</p> </body></html> This will break Jenkins startup on the next restart. If I use the Jenkins CLI to install from http://updates.jenkins.io , it succeeds: java -jar jenkins-cli.jar -logger FINE -s http: //cje.example.com:8081 -auth admin:admin install-plugin https://updates.jenkins.io/download/plugins/groovy/2.2/groovy.hpi Jul 19, 2019 2:34:09 PM org.apache.sshd.common.util.security.SecurityUtils register FINE: register(BC) not registered - enabled= true , supported= false Jul 19, 2019 2:34:09 PM org.apache.sshd.common.util.security.AbstractSecurityProviderRegistrar getOrCreateProvider INFO: getOrCreateProvider(EdDSA) created instance of net.i2p.crypto.eddsa.EdDSASecurityProvider Jul 19, 2019 2:34:09 PM hudson.cli.CLI _main FINE: using connection mode HTTP Jul 19, 2019 2:34:09 PM hudson.cli.CLI plainHttpConnection FINE: Trying to connect to http: //allan.oss.com:8081/ via plain protocol over HTTP Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init> FINE: establishing download side Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init> FINE: established download side Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init> FINE: establishing upload side Jul 19, 2019 2:34:09 PM hudson.cli.FullDuplexHttpStream <init> FINE: established upload side Installing a plugin from https: //updates.jenkins.io/download/plugins/groovy/2.2/groovy.hpi 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
          jglick Jesse Glick added a comment -

          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.

          jglick Jesse Glick added a comment - 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.
          oleg_nenashev Oleg Nenashev added a comment -

          Some follow-ups were addressed in Jenkins 2.189

          oleg_nenashev Oleg Nenashev added a comment - Some follow-ups were addressed in Jenkins 2.189
          jglick Jesse Glick added a comment -

          Not sure I would consider this “fixed”, exactly—Jenkins still does not follow redirects—but the behavior is certainly better than before.

          jglick Jesse Glick added a comment - Not sure I would consider this “fixed”, exactly—Jenkins still does not follow redirects—but the behavior is certainly better than before.
          danielbeck Daniel Beck added a comment -

          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 Daniel Beck added a comment - 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.

          People

            Unassigned Unassigned
            anthonygreen Anthony Green
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: