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

InstallPluginCommand: Cannot upgrade bundled plugins

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • cli, core
    • None
    • # java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ version
      1.622

      I believe this bug affects any plugins, so I've marked it major. It seems be https://issues.jenkins-ci.org/browse/JENKINS-12514 but I'm not 100% sure so I didn't want to re-open.

      Basically, I'm unable to upgrade ssh-credentials-plugin. Because I use chef, this means chef tries and restarts Jenkins repeatedly, making the service unusable.

      Steps to reproduce:

      1. java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ list-plugins | grep ssh-credentials
        ssh-credentials SSH Credentials Plugin 1.10 (1.11)
      1. java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ install-plugin http://updates.jenkins-ci.org/latest/ssh-credentials.hpi
        Installing a plugin from http://updates.jenkins-ci.org/latest/ssh-credentials.hpi
      1. java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ list-plugins | grep ssh-credentials
        ssh-credentials SSH Credentials Plugin 1.10 (1.11)
      1. service jenkins restart
      • Restarting Jenkins Continuous Integration Server jenkins [ OK ]
      1. java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ list-plugins | grep ssh-credentials
        ssh-credentials SSH Credentials Plugin 1.10 (1.11)

      (expected version 1.11).

      Other potentially useful information:

      1. find /var/lib/jenkins -type f -iname "ssh-credentials"
        /var/lib/jenkins/plugins/ssh-credentials.jpi
      1. cp /var/lib/jenkins/plugins/ssh-credentials.jpi /tmp/
      2. unzip /tmp/ssh-credentials.jpi
      1. grep -i version META-INF/MANIFEST.MF
        Manifest-Version: 1.0
        Archiver-Version: Plexus Archiver
        Implementation-Version: 1.10
        Compatible-Since-Version: 1.0
        Plugin-Version: 1.10
        Hudson-Version: 1.532.2
        Jenkins-Version: 1.532.2
      1. java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ install-plugin http://updates.jenkins-ci.org/latest/ssh-credentials.hpi -deploy
        Installing a plugin from http://updates.jenkins-ci.org/latest/ssh-credentials.hpi
        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:215)
        at java.util.zip.ZipFile.<init>(ZipFile.java:145)
        at java.util.jar.JarFile.<init>(JarFile.java:154)
        at java.util.jar.JarFile.<init>(JarFile.java:133)
        at hudson.ClassicPluginStrategy.getShortName(ClassicPluginStrategy.java:107)
        at hudson.PluginManager.dynamicLoad(PluginManager.java:439)
        at hudson.cli.InstallPluginCommand.run(InstallPluginCommand.java:105)
        at hudson.cli.CLICommand.main(CLICommand.java:237)
        at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:608)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:583)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:542)
        at hudson.remoting.UserRequest.perform(UserRequest.java:121)
        at hudson.remoting.UserRequest.perform(UserRequest.java:49)
        at hudson.remoting.Request$2.run(Request.java:326)
        at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
        at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
        at hudson.remoting.CallableDecoratorAdapter.call(CallableDecoratorAdapter.java:18)
        at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
        at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

      (Downloading and unzipping manually works great.)

          [JENKINS-29726] InstallPluginCommand: Cannot upgrade bundled plugins

          Martin Smith added a comment -

          Nothing interesting in the Jenkins log as far as I can tell:

          Jul 30, 2015 3:21:00 PM hudson.TcpSlaveAgentListener$ConnectionHandler run
          INFO: Accepted connection #5 from /127.0.0.1:45076
          Jul 30, 2015 3:21:10 PM hudson.TcpSlaveAgentListener$ConnectionHandler run
          INFO: Accepted connection #6 from /127.0.0.1:45078
          Jul 30, 2015 3:21:12 PM hudson.PluginManager dynamicLoad
          INFO: Attempting to dynamic load /var/lib/jenkins/plugins/ssh-credentials.jpi

          Martin Smith added a comment - Nothing interesting in the Jenkins log as far as I can tell: Jul 30, 2015 3:21:00 PM hudson.TcpSlaveAgentListener$ConnectionHandler run INFO: Accepted connection #5 from /127.0.0.1:45076 Jul 30, 2015 3:21:10 PM hudson.TcpSlaveAgentListener$ConnectionHandler run INFO: Accepted connection #6 from /127.0.0.1:45078 Jul 30, 2015 3:21:12 PM hudson.PluginManager dynamicLoad INFO: Attempting to dynamic load /var/lib/jenkins/plugins/ssh-credentials.jpi

          Daniel Beck added a comment -

          (Downloading and unzipping manually works great.)

          Your Jenkins may get a different mirror than you do. Errors to download a plugin from the Jenkins UI show the URL this gets redirected to.

          Daniel Beck added a comment - (Downloading and unzipping manually works great.) Your Jenkins may get a different mirror than you do. Errors to download a plugin from the Jenkins UI show the URL this gets redirected to.

          Martin Smith added a comment -

          This was all on the same machine that I tested. This is also occurring in CI across multiple machines. I don't think this is an issue with the mirror. This is easily reproducible even using a single mirror.

          Martin Smith added a comment - This was all on the same machine that I tested. This is also occurring in CI across multiple machines. I don't think this is an issue with the mirror. This is easily reproducible even using a single mirror.

          Edmund Haselwanter added a comment - - edited

          same here

          sudo  java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ version
          1.628
          
          sudo  java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ list-plugins |grep credentials
          plain-credentials         Plain Credentials Plugin             1.1
          credentials               Credentials Plugin                   1.18 (1.24)
          ssh-credentials           SSH Credentials Plugin               1.10 (1.11)
          
            Recipe: <Dynamically Defined Resource>
              * remote_file[/var/chef/cache/credentials-1.24.plugin] action create (up to date)
              * remote_file[/var/chef/cache/jenkins-cli.jar] action create (up to date)
              - Upgrade jenkins_plugin[credentials] from 1.18 to 1.24
              * remote_file[/var/chef/cache/ssh-credentials-1.11.plugin] action create (up to date)
              - Upgrade jenkins_plugin[ssh-credentials] from 1.10 to 1.11
          
          
          sudo  java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ list-plugins |grep credentials
          plain-credentials         Plain Credentials Plugin             1.1
          credentials               Credentials Plugin                   1.18 (1.24)
          ssh-credentials           SSH Credentials Plugin               1.10 (1.11)
          

          Edmund Haselwanter added a comment - - edited same here sudo java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ version 1.628 sudo java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ list-plugins |grep credentials plain-credentials Plain Credentials Plugin 1.1 credentials Credentials Plugin 1.18 (1.24) ssh-credentials SSH Credentials Plugin 1.10 (1.11) Recipe: <Dynamically Defined Resource> * remote_file[/var/chef/cache/credentials-1.24.plugin] action create (up to date) * remote_file[/var/chef/cache/jenkins-cli.jar] action create (up to date) - Upgrade jenkins_plugin[credentials] from 1.18 to 1.24 * remote_file[/var/chef/cache/ssh-credentials-1.11.plugin] action create (up to date) - Upgrade jenkins_plugin[ssh-credentials] from 1.10 to 1.11 sudo java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ list-plugins |grep credentials plain-credentials Plain Credentials Plugin 1.1 credentials Credentials Plugin 1.18 (1.24) ssh-credentials SSH Credentials Plugin 1.10 (1.11)

          Daniel Beck added a comment - - edited

          This affects all plugins bundled with Jenkins because of a bug in InstallPluginCommand: It does not bother to determine whether the installed plugin is a bundled plugin and then create the pinned file (https://wiki.jenkins-ci.org/display/JENKINS/Pinned+Plugins)

          Daniel Beck added a comment - - edited This affects all plugins bundled with Jenkins because of a bug in InstallPluginCommand : It does not bother to determine whether the installed plugin is a bundled plugin and then create the pinned file ( https://wiki.jenkins-ci.org/display/JENKINS/Pinned+Plugins )

          Daniel Beck added a comment -

          FWIW this issue is likely obsolete with the release of Jenkins 2.x and the related changes to the plugin model – can anyone confirm?

          Daniel Beck added a comment - FWIW this issue is likely obsolete with the release of Jenkins 2.x and the related changes to the plugin model – can anyone confirm?

          Daniel Beck added a comment -

          No response in several months, so assuming this actually is obsolete has most of the bundled plugin functionality including 'Pinned Plugins' has been removed in 2.0

          Daniel Beck added a comment - No response in several months, so assuming this actually is obsolete has most of the bundled plugin functionality including 'Pinned Plugins' has been removed in 2.0

          Wayne Warren added a comment -

          danielbeck I just ran into this on Jenkins 2.48.  I am working on docker-based integration tests for a plugin where I:

          • start up a docker container with Jenkins 2.48 installed, 
          • install all plugins used on my production jenkins instance on the docker container jenkins instance using jenkins-cli.jar (this includes a released version of the plugin I am working on)
          • then use jenkins-cli.jar to install a just-built snapshot version of the same plugin on the docker container jenkins instance

          This sequence of steps leads to the issue described here. I'll probably work around it by:

          • shutting down jenkins
          • removing the existing plugin from the plugins directory
          • starting jenkins

          This is acceptable for the current problem I am dealing with, but a different automated workflow such as using configuration management to manage a jenkins instance may not be able to tolerate a jenkins shutdown for the sake of upgrading a plugin. Although for all I know avoiding a shutdown may be altogether unavoidable in any case, but I thought it would be worth mentioning that I was able to reproduce this.

          Wayne Warren added a comment - danielbeck I just ran into this on Jenkins 2.48.  I am working on docker-based integration tests for a plugin where I: start up a docker container with Jenkins 2.48 installed,  install all plugins used on my production jenkins instance on the docker container jenkins instance using jenkins-cli.jar (this includes a released version of the plugin I am working on) then use jenkins-cli.jar to install a just-built snapshot version of the same plugin on the docker container jenkins instance This sequence of steps leads to the issue described here. I'll probably work around it by: shutting down jenkins removing the existing plugin from the plugins directory starting jenkins This is acceptable for the current problem I am dealing with, but a different automated workflow such as using configuration management to manage a jenkins instance may not be able to tolerate a jenkins shutdown for the sake of upgrading a plugin. Although for all I know avoiding a shutdown may be altogether unavoidable in any case, but I thought it would be worth mentioning that I was able to reproduce this.

          Daniel Beck added a comment -

          a jenkins instance may not be able to tolerate a jenkins shutdown for the sake of upgrading a plugin

          This has nothing to do with this issue, and upgrading an already installed plugin using any method has always required a restart.

          Daniel Beck added a comment - a jenkins instance may not be able to tolerate a jenkins shutdown for the sake of upgrading a plugin This has nothing to do with this issue, and upgrading an already installed plugin using any method has always required a restart.

            danielbeck Daniel Beck
            martinb3 Martin Smith
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: