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

http://<JENKINS>/pluginManager/checkUpdates does not work without GUI / javascript

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • core
    • None

      testcases (everything scripted / headless):
      1. download war
      2. start webserver
      3. cli command install-plugin active-directory (which plugin does not matter)

      1. download war
      2. start webserver
      3. wget -O /dev/null http://<JENKINS>/pluginManager/checkUpdates
      4. cli command install-plugin active-directory (which plugin does not matter)

      e.g.
      $ java -jar /tmp/intelligence/jenkins-cli.jar -s http://localhost:8080/jenkins install-plugin active-directory
      active-directory is neither a valid file, URL, nor a plugin artifact name in the update center
      No update center data is retrieved yet from: http://updates.jenkins-ci.org/update-center.json
      active-directory looks like a short plugin name. Did you mean 'null'?

      — pieces of chat log —
      [14:25] <damien___> hello
      [14:26] <damien___> does anyone know what url triggers the webserver to fetch the update center json file?
      [14:27] <damien___> I'm trying to have a script that from a war file 1. starts it, 2. install plugins from a list
      [14:27] <damien___> list has short names
      [14:35] <mrobinet> damien___ http://<JENKINS>/pluginManager/checkUpdates
      [14:41] <damien___> mrobinet: doesn't seem to work in 1.417
      [14:41] <damien___> i'm using CLI only
      [14:41] <mrobinet> hmm
      [14:42] <mrobinet> You can't just curl that URL?
      [14:42] <damien___> i did
      [14:42] <damien___> it doesn't seem to do the right thing
      [14:43] <mrobinet> Ahh, nm, it requires auth
      [14:43] <mrobinet> Not sure if/how you can do it from CLI
      [14:43] <damien___> my instance is pristine, no auth
      [14:44] <mrobinet> I'm at a loss then. That is the URL I see posted to when I examine the net traffic when asking it to update
      [14:44] <damien___> hitting that url gives me html content that seems legit
      [14:45] <damien___> but the server doesn't go and download the json file
      [14:46] <damien___> oh my... I think I found the quirk
      [14:47] <damien___> the /pluginManager/checkUpdates page has javascript
      [14:47] <damien___> this goes and download the json file using YUI
      [14:48] <damien___> then this sends an http POST with stuff to /updateCenter/byId/default/postBack
      [14:49] <mrobinet> Yeah, that is what I see too, but I'm not sure what is missing
      [14:52] <damien___> erh, curl doesn't exec the javascript
      [14:52] <damien___> so the json doesn't get downloaded
      [14:52] <damien___> and doesn't get POST'd to jenkins instance
      [14:54] <mrobinet> I think there is a CLI to exec a custom groovy script. You might be able to use that to force the update
      [14:57] <damien___> I wonder why that code is on the user side rather than server side?
      [14:58] <damien___> mrobinet: thanks

          [JENKINS-10061] http://<JENKINS>/pluginManager/checkUpdates does not work without GUI / javascript

          Damien Nozay added a comment -

          update center could probably have its check updates changed to:

          System.properties.putAll( ["http.proxyHost":"proxy-host", "http.proxyPort":"proxy-port","http.proxyUserName":"proxy-user", "http.proxyPassword":"proxy-password"] )
          update_center = hudson.model.Hudson.instance.updateCenter;
          update_site = update_center.sites.find

          { it.id.equals('default') }

          URL updatejson = new URL(update_site.url)
          update_site.dataFile.write(updatejson.text)

          except the update center json currently does NOT return json.
          see https://issues.jenkins-ci.org/browse/JENKINS-10062 for that.

          Damien Nozay added a comment - update center could probably have its check updates changed to: System.properties.putAll( ["http.proxyHost":"proxy-host", "http.proxyPort":"proxy-port","http.proxyUserName":"proxy-user", "http.proxyPassword":"proxy-password"] ) update_center = hudson.model.Hudson.instance.updateCenter; update_site = update_center.sites.find { it.id.equals('default') } URL updatejson = new URL(update_site.url) update_site.dataFile.write(updatejson.text) except the update center json currently does NOT return json. see https://issues.jenkins-ci.org/browse/JENKINS-10062 for that.

          I think it'd be worthwhile to make the install-plugin command smarter and attempt to retrieve the update center metadata, both by using the server and the CLI client.

          We should also have a separate CLI command to force-feed the metadata.

          Kohsuke Kawaguchi added a comment - I think it'd be worthwhile to make the install-plugin command smarter and attempt to retrieve the update center metadata, both by using the server and the CLI client. We should also have a separate CLI command to force-feed the metadata.

          I agree with you. This will make unattended installations much more easy.
          I am puppetizing plugins installations and I can't get ride of this GUI dependency.

          Marc Villacorta added a comment - I agree with you. This will make unattended installations much more easy. I am puppetizing plugins installations and I can't get ride of this GUI dependency.

          Kelvin Luck added a comment -

          This is also making it impossible for me to have automated unattended installs.

          Especially since it also doesn't seem to work when I use the complete URL to the plugin e.g. The following URL gives no errors but the plugin isn't installed when I check in the web interface:

          jenkins-cli -s http://localhost:8080 install-plugin http://updates.jenkins-ci.org/download/plugins/greenballs/1.12/greenballs.hpi -restart

          Kelvin Luck added a comment - This is also making it impossible for me to have automated unattended installs. Especially since it also doesn't seem to work when I use the complete URL to the plugin e.g. The following URL gives no errors but the plugin isn't installed when I check in the web interface: jenkins-cli -s http://localhost:8080 install-plugin http://updates.jenkins-ci.org/download/plugins/greenballs/1.12/greenballs.hpi -restart

          Reto Kaiser added a comment -

          Here's another workaround, if you have access to jenkin's home-directory:

          curl -L http://updates.jenkins-ci.org/update-center.json | sed '1d;$d' > /var/lib/jenkins/updates/default.json
          

          via https://gist.github.com/1026918

          Reto Kaiser added a comment - Here's another workaround, if you have access to jenkin's home-directory: curl -L http://updates.jenkins-ci.org/update-center.json | sed '1d;$d' > /var/lib/jenkins/updates/default.json via https://gist.github.com/1026918

          ravn added a comment -

          I want to script our Jenkins instances starting from a freshly downloaded LTS without user actions, so I have now spent some time on figuring out what happens, and it looks like that Jenkins generates Javascript to tell itself what to update including the URL to retrieve (really?). I.e. entering the /manage page in a Javascript enabled browser triggers downloading the update center files.

          Is there any way now - with a current LTS - besides executing the Javascript on the page to tell Jenkins to trigger the download?

          ravn added a comment - I want to script our Jenkins instances starting from a freshly downloaded LTS without user actions, so I have now spent some time on figuring out what happens, and it looks like that Jenkins generates Javascript to tell itself what to update including the URL to retrieve (really?). I.e. entering the /manage page in a Javascript enabled browser triggers downloading the update center files. Is there any way now - with a current LTS - besides executing the Javascript on the page to tell Jenkins to trigger the download?

          Daniel Beck added a comment -

          Close enough: Jenkins now downloads from the server by default. If it still doesn't work, please file a new bug, as the situation has changed since this was filed.

          For an alternative scripting approach (in the context of a similar issue), see my message to the jenkinsci-users list on June 6.

          Daniel Beck added a comment - Close enough: Jenkins now downloads from the server by default. If it still doesn't work, please file a new bug, as the situation has changed since this was filed. For an alternative scripting approach (in the context of a similar issue), see my message to the jenkinsci-users list on June 6 .

          Jesse Glick added a comment -

          Jenkins now downloads from the server by default

          No, this is not (yet) the default.

          Jesse Glick added a comment - Jenkins now downloads from the server by default No, this is not (yet) the default.

            Unassigned Unassigned
            dnozay Damien Nozay
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: