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

Plugin manager reports wrong version when both .hpi and .jpi filenames exist for the same plugin with different versions

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • core
    • None
    • Jenkins LTS 2.303.1
      openjdk version "11.0.9" 2020-10-20

      Issue

      I've found that if you put the same plugin with both .hpi and .jpi extensions (and with different versions) in `JENKINS_HOME/plugins`, the `.hpi` plugin content will be expanded, but the `.jpi` plugin version will be the one reported under `Manage Jenkins` -> `Manage Plugins` -> `Installed`.

      Why this is important to fix

      I almost was going to file this as a bug because the plugin manager is reporting the incorrect version of the plugin that is being used. Technically this is an unsupported use case, and would require an administrator to be manually copying in plugins into `JENKINS_HOME/plugins` and not being careful to check if the alternate plugin extension already exists, hence I have filed this as an improvement.

      I've filed this as Major priority for now, because when the plugin manger (and hence the support-core plugin) reports version X of a plugin is being used, but the actual plugin version functionality is Y, it can significantly delay troubleshooting of plugin issues.

      Steps to reproduce

      1. Start a fresh Jenkins LTS 2.303.1 instance
      2. Choose to install the default plugins
      3. Stop the instance
      4. Copy two different versions of a plugin with different file extensions into the plugins directory, for example:
        jenkins-home/plugins/kubernetes.hpi (which is 1.28.6)
        jenkins-home/plugins/kubernetes.jpi (which is 1.30.0)
      1. Start the instance
      2. Note that the plugin that was expanded was the `.hpi` version:
        grep Plugin-Version jenkins-home/plugins/kubernetes/META-INF/MANIFEST.MF
        Plugin-Version: 1.28.6
      1. Check `Manage Jenkins` -> `Manage Plugins` -> `Installed` and you will see the Kubernetes plugin version listed as version `1.30.0` (which is inaccurate, it should be showing 1.28.6 here)

      Additional notes

      There is a diagnostic message emitted upon startup when duplicate plugins are found, for example:

      INFO hudson.PluginManager$1$3$1#isDuplicate: Ignoring /Users/rkivisto/jenkins-home/plugins/kubernetes.hpi because /Users/rkivisto/jenkins-home/plugins/kubernetes.jpi is already loaded

      This is from: https://github.com/jenkinsci/jenkins/blob/89d334145d2755f74f82aad07b5df4119d7fa6ce/core/src/main/java/hudson/PluginManager.java#L446

      It seems reasonable to throw a severe exception at this line, instead of an informational message, or alternatively, the plugin manager code that detects current plugin versions could be fixed to detect the correct plugin version in this situation.

            Unassigned Unassigned
            rkivisto Ray Kivisto
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: