jenkinsci / docker

Docker official jenkins repo
https://hub.docker.com/r/jenkins/jenkins
MIT License
6.66k stars 4.52k forks source link

Unable to upgrade plugin in Docker Jenkins due to version format #1456

Open linbjo opened 2 years ago

linbjo commented 2 years ago

Jenkins and plugins versions report

Environment ```text ace-editor:1.1 active-directory:2.26 analysis-model-api:10.16.1 ant:475.vf34069fef73c antisamy-markup-formatter:2.7 apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61 authentication-tokens:1.4 authorize-project:1.4.0 basic-branch-build-strategies:1.3.2 bitbucket:223.vd12f2bca5430 blueocean:1.25.7 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.25.7 blueocean-commons:1.25.7 blueocean-config:1.25.7 blueocean-core-js:1.25.7 blueocean-dashboard:1.25.7 blueocean-display-url:2.4.1 blueocean-events:1.25.7 blueocean-git-pipeline:1.25.7 blueocean-github-pipeline:1.25.7 blueocean-i18n:1.25.7 blueocean-jira:1.25.7 blueocean-jwt:1.25.7 blueocean-personalization:1.25.7 blueocean-pipeline-api-impl:1.25.7 blueocean-pipeline-editor:1.25.7 blueocean-pipeline-scm-api:1.25.7 blueocean-rest:1.25.7 blueocean-rest-impl:1.25.7 blueocean-web:1.25.7 bootstrap4-api:4.6.0-5 bootstrap5-api:5.2.0-3 bouncycastle-api:2.26 branch-api:2.1046.v0ca_37783ecc5 build-monitor-plugin:1.13+build.202205140447 build-timeout:1.24 caffeine-api:2.9.3-65.v6a_47d0f4d1fe checks-api:1.7.5 cloudbees-bitbucket-branch-source:791.vb_eea_a_476405b cloudbees-folder:6.740.ve4f4ffa_dea_54 command-launcher:84.v4a_97f2027398 commons-lang3-api:3.12.0-36.vd97de6465d5b_ commons-text-api:1.9-19.v8df45c678366 configuration-as-code:1512.vb_79d418d5fc8 credentials:1143.vb_e8b_b_ceee347 credentials-binding:523.vd859a_4b_122e6 data-tables-api:1.12.1-3 display-url-api:2.3.6 docker-commons:1.21 docker-workflow:521.v1a_a_dd2073b_2e durable-task:500.v8927d9fd99d8 echarts-api:5.3.3-1 email-ext:2.91 extended-read-permission:3.2 favorite:2.4.1 font-awesome-api:6.1.2-1 forensics-api:1.15.1 generic-webhook-trigger:1.84 git:4.11.5 git-client:3.11.2 git-parameter:0.9.17 git-server:1.11 github:1.34.5 github-api:1.303-400.v35c2d8258028 github-branch-source:1687.v7618247e672d gradle:1.39.4 handlebars:3.0.8 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 htmlpublisher:1.30 jackson2-api:2.13.3-285.vc03c0256d517 jakarta-activation-api:2.0.1-1 jakarta-mail-api:2.0.1-1 javax-activation-api:1.2.0-4 javax-mail-api:1.6.2-7 jaxb:2.3.6-1 jdk-tool:55.v1b_32b_6ca_f9ca jenkins-design-language:1.25.7 jersey2-api:2.36-2 jira:3.8 jjwt-api:0.11.5-77.v646c772fddb_0 job-dsl:1.81 jquery:1.12.4-1 jquery-detached:1.2.1 jquery3-api:3.6.0-4 jsch:0.1.55.61.va_e9ee26616e7 junit:1119.1121.vc43d0fc45561 ldap:2.12 lockable-resources:2.16 mailer:435.v79ef3972b_5c7 mapdb-api:1.0.9-28.vf251ce40855d matrix-auth:3.1.5 matrix-project:772.v494f19991984 mercurial:1251.va_b_121f184902 mina-sshd-api-common:2.8.0-36.v8e25ce90d4b_1 mina-sshd-api-core:2.8.0-36.v8e25ce90d4b_1 momentjs:1.1.1 multibranch-scan-webhook-trigger:1.0.9 okhttp-api:4.9.3-108.v0feda04578cf pam-auth:1.10 pipeline-build-step:2.18 pipeline-github-lib:38.v445716ea_edda_ pipeline-graph-analysis:195.v5812d95a_a_2f9 pipeline-groovy-lib:612.v84da_9c54906d pipeline-input-step:449.v77f0e8b_845c4 pipeline-milestone-step:101.vd572fef9d926 pipeline-model-api:2.2114.v2654ca_721309 pipeline-model-definition:2.2114.v2654ca_721309 pipeline-model-extensions:2.2114.v2654ca_721309 pipeline-rest-api:2.24 pipeline-stage-step:296.v5f6908f017a_5 pipeline-stage-tags-metadata:2.2114.v2654ca_721309 pipeline-stage-view:2.24 plain-credentials:139.ved2b_9cf7587b plugin-util-api:2.17.0 popper-api:1.16.1-3 popper2-api:2.11.6-1 prism-api:1.28.0-2 pubsub-light:1.16 rebuild:1.34 resource-disposer:0.20 scm-api:621.vda_a_b_055e58f7 script-security:1175.v4b_d517d6db_f0 show-build-parameters:1.0 simple-theme-plugin:103.va_161d09c38c7 snakeyaml-api:1.31-84.ve43da_fb_49d0b sse-gateway:1.25 ssh-agent:295.v9ca_a_1c7cc3a_a_ ssh-credentials:305.v8f4381501156 ssh-slaves:1.834.v622da_57f702c sshd:3.242.va_db_9da_b_26a_c3 stashNotifier:1.28 structs:324.va_f5d6774f3a_d subversion:2.16.0 timestamper:1.19 token-macro:308.v4f2b_ed62b_b_16 trilead-api:1.67.vc3938a_35172f variant:59.vf075fe829ccb warnings-ng:9.19.1 windows-slaves:1.8.1 workflow-aggregator:590.v6a_d052e5a_a_b_5 workflow-api:1192.v2d0deb_19d212 workflow-basic-steps:994.vd57e3ca_46d24 workflow-cps:2759.v87459c4eea_ca_ workflow-durable-task-step:1199.v02b_9244f8064 workflow-job:1207.ve6191ff089f8 workflow-multibranch:716.vc692a_e52371b_ workflow-scm-step:400.v6b_89a_1317c9a_ workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:838.va_3a_087b_4055b ws-cleanup:0.43 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Docker on Linux. Jenkins deployed in Docker using the image jenkins/jenkins:2.346.3-jdk11.

Reproduction steps

  1. Run Jenkins in Docker using the official LTS image, jenkins/jenkins:2.346.3-jdk11, with Jenkins data saved to a Docker volume.
  2. Install commons-lang3-api:3.12.0.0 plugin.
  3. Create a custom Jenkins Docker image (based on the official one above) that uses (for example) plugins.txt and jenkins-plugin-cli to install the newer plugin version, commons-lang3-api:3.12.0-36.vd97de6465d5b_ .
  4. Run Jenkins in Docker using the new image and the existing volume.

Expected Results

The plugin is upgraded to version 3.12.0-36.vd97de6465d5b_.

Actual Results

The plugin is not upgraded. From $JENKINS_HOME/copy_reference_file.log: SKIPPED plugins/commons-lang3-api.jpi : Image version (3.12.0-36.vd97de6465d5b_) is older than installed version (3.12.0.0)

Anything else?

Looks like this is due to how the Jenkins Docker image handles version comparisons when installing plugins. https://github.com/jenkinsci/docker/blob/master/jenkins-support contains a function versionLT() that does the comparison. It appears to ignore anything behind a dash ('-') unless the main versions (before the dash) are equal. In this case it sorts 3.12.0.0 as newer/higher than 3.12.0.

Not sure if this should be considered a problem with the plugin version or the Docker image, but it is preventing the upgrade of the plugin. This in turn causes other plugins with dependencies on the new version to fail to load during Jenkins startup (in my case jira:3.8).

timja commented 2 years ago

Transferring as this is a bug in the docker project

To work around it delete the old version and then upgrade again

linbjo commented 2 years ago

Thanks for the quick reply! I'll work around it by uninstalling the affected plugins. I see that I have at least one more plugin that is affected: SKIPPED plugins/mapdb-api.jpi : Image version (1.0.9-28.vf251ce40855d) is older than installed version (1.0.9.0)

timja commented 2 years ago

Some discussion on gitter explaining the issue: https://gitter.im/jenkinsci/docker?at=6318b7a23a42316d33dc82df

rahulsurwade08 commented 2 years ago

Hey @linbjo , I would love to contribute to this under Hacktoberfest. How can i get started?

linbjo commented 2 years ago

Hi @RahulSurwade08 ! Unfortunately I can't answer that. I just found and reported the problem. I'm not a contributor and don't have any insight into the development of this project. Someone who's actively involved might have an idea.

Nandini99-git commented 1 year ago

Hi @linbjo ,I want to work on this and try to solve this.

Nandini99-git commented 1 year ago

docker run -p 8080:8080 -p 50000:50000 -v /var/run/docker.soc k:/var/run/docker.sock --name jenkins jenkins use this

AtrikeshM commented 1 year ago

I want to work on this issue. Please assign me.

mawinter69 commented 1 year ago

Another issue: SKIPPED plugins/role-strategy.jpi : Image version (587.588.v850a_20a_30162) is older than installed version (587.v2872c41fa_e51)

wangcanfengxs commented 8 months ago

SKIPPED plugins/mapdb-api.jpi : Image version (1.0.9-28.vf251ce40855d) is older than installed version (1.0.9.0) SKIPPED plugins/snakeyaml-api.jpi : Installed version (2.2-111.vc6598e30cc65) has been manually upgraded from initial version (1.29.1)