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

Can't get plugins list and can't install plugins from update center

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Blocker Blocker
    • core
    • None
    • Ubuntu 16.04.1 LTS
      Oracle JRE 1.7.0_25, OpenJDK8
      Jenkins 2.7.4 LTS and Jenkins 2.22

      Maybe this issue is related to JDK-4620571 : urlconnection following redirect uses protocol of original request http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4620571

      I installed Jenkins 2.7.4 LTS from ubuntu apt repository following the offical installation guide.

      Then I navigated to the jenkins webapp url. After filled in initial admin password, loading indicator was shown for some time, and I got a message "This Jenkins instance appears to be offline." I am sure the network connection is fine and not behind any proxy. I skipped proxy configuration. Jenkins runs fine, but when I opened plugins manager, no plugins found. Since I have been worked with Hudson (before Jenkins split from Hudson) for quite long time I knew some problem occured. When I checked log file, I got following log entry:

      WARNING: Upgrading Jenkins. Failed to update the default Update Site 'default'. Plugin upgrades may fail.
      java.io.IOException: Could not find JSON in http://updates.jenkins-ci.org/update-center.json?id=default&version=2.7.4
      at hudson.model.DownloadService.loadJSON(DownloadService.java:174)
      at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:176)
      at hudson.model.UpdateCenter.updateDefaultSite(UpdateCenter.java:2181)
      at jenkins.install.SetupWizard.init(SetupWizard.java:170)
      at jenkins.install.InstallState$3.initializeState(InstallState.java:105)
      at jenkins.model.Jenkins.setInstallState(Jenkins.java:970)
      at jenkins.install.InstallUtil.proceedToNextStateFrom(InstallUtil.java:94)
      at jenkins.model.Jenkins.<init>(Jenkins.java:887)
      at hudson.model.Hudson.<init>(Hudson.java:85)
      at hudson.model.Hudson.<init>(Hudson.java:81)
      at hudson.WebAppMain$3.run(WebAppMain.java:227)

      I tried to check the update site url with shell

      curl http://updates.jenkins-ci.org/update-center.json&#63;id=default\&version=2.7.4

      . The response is a 301 redirect. After another two 302 redirects, I got the final update site url:

      https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/stable-2.7/update-center.json

      The entire network flow of update site:

      http://updates.jenkins-ci.org/update-center.json?id=default&version=2.7.4
      301 http://updates.jenkins-ci.org/stable-2.7/update-center.json
      302 http://mirrors.jenkins-ci.org/updates/stable-2.7/update-center.json
      302 https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/stable-2.7/update-center.json

      Then I changed the default update site url to this mirror url, I could get plugins list now. But when I tried to install some plugins, failed. I checked the log file and found following message:

      SEVERE: Failed to install SCM API Plugin
      java.io.IOException: Downloaded file /var/lib/jenkins/plugins/scm-api.jpi.tmp does not match expected SHA-1, expected 'GSoCVeUDmMHHd4hvIx6GHlvzA1g=', actual 'NUD1ONAUpGfIc3Hk0DiYO5HhS48='
      at hudson.model.UpdateCenter.verifyChecksums(UpdateCenter.java:1799)
      at hudson.model.UpdateCenter.access$1100(UpdateCenter.java:147)
      at hudson.model.UpdateCenter$InstallationJob.replace(UpdateCenter.java:1950)
      at hudson.model.UpdateCenter$UpdateCenterConfiguration.install(UpdateCenter.java:1194)
      at hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:1669)
      at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1864)
      at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1640)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110)
      at java.lang.Thread.run(Thread.java:745)

      I opened scm-api.jpi.tmp, it was a html file:

      <!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="https://mirrors.tuna.tsinghua.edu.cn/jenkins/plugins/scm-api/1.3/scm-api.hpi">here</a>.</p>
      </body></html>

      I can't figure out what happened. So I uninstalled 2.7.4, and installed 2.22 from apt reposity, the problem is still there. And I tried to install jenkins web app into tomcat 8.55, the problem is not resolved. I also tried openjdk8, before that oracle jdk 1.7.0_25 was used.

      Today, I cloned the source code from github, tried to add some log with

      hudson.model.DownloadService.loadJSON(URL src)

      around line 170. I found that when using default update site url URLConnection stopped to follow the last 302 redirect to

      https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/current/update-center.json

      After that I checked the update site json content. The "scm-api" plugin's url is

      http://updates.jenkins-ci.org/download/plugins/scm-api/1.3/scm-api.hpi

      There will be two 302 redirects, the final url is

      https://mirrors.tuna.tsinghua.edu.cn/jenkins/plugins/scm-api/1.3/scm-api.hpi

      The entire network flow of a plugin:

      http://updates.jenkins-ci.org/download/plugins/scm-api/1.3/scm-api.hpi
      302 http://mirrors.jenkins-ci.org/plugins/scm-api/1.3/scm-api.hpi
      302 https://mirrors.tuna.tsinghua.edu.cn/jenkins/plugins/scm-api/1.3/scm-api.hpi

      After searching, I found the JDK issue record mentioned at the beginning.

      I'm not sure whether it is the reason. Maybe, Jenkins update site should enforce https.

      I want to change update-center.json with all the url directly pointed to the mirror site, and deployed to an internal server, but jenkins refused to accept it since the checksum digest is changed. So there is no work around for me.

            Unassigned Unassigned
            zouxifeng Xifeng Zou
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: