Jenkins plugin cli download wrong plugin version

I built a jenkins docker image using jenkins-plugin-cli and all works fine.

Now I have to add a new plugin so I modify my plugin.txt and run docker build, but it fail because plugin version downloaded are wrong.

This is the output:

[0me[91mNo directory to download plugins entered. Will use default of /usr/share/jenkins/ref/plugins
Using update center https://updates.jenkins.io/update-center.json from JENKINS_UC environment variable
Using experimental update center https://updates.jenkins.io/experimental/update-center.json from JENKINS_UC_EXPERIMENTAL environment variable
Using incrementals mirror Index of incrementals/ from JENKINS_INCREMENTALS_REPO_MIRROR environment variable
No CLI option or environment variable set for plugin info, using default of https://updates.jenkins.io/plugin-versions.json
e[0me[91mNo war entered. Will use default of /usr/share/jenkins/jenkins.war
e[0me[91m
Retrieving update center information
e[0me[91mCreated cache at: /var/jenkins_home/.cache/jenkins-plugin-management-cli
e[0me[91mUpdate center URL: https://updates.jenkins.io/update-center.json?version=2.346.3
e[0me[91mCache miss for: update-center-2.346.3
e[0me[91mDownloaded update-center-2.346.3 from https://updates.jenkins.io/dynamic-stable-2.375.1/update-center.json (attempt 1 of 3)
e[0me[91mCache miss for: experimental-update-center-2.346.3
e[0me[91mCache miss for: plugin-versions
e[0me[91mDownloaded plugin-versions from https://updates.jenkins.io/current/plugin-versions.json (attempt 1 of 3)e[0me[91m

It seems that the list for 2.346.3 version is missing ad it returns the plugin version list about the current version.

If I try to curl https://updates.jenkins.io/update-center.json?version=2.346.3 I get 302 redirect to https://updates.jenkins.io/dynamic-stable-2.375.1/update-center.json.

Is this an error or jenkins version 2.346.3 is no more supported?

Here is my current Jenkins setup:

Jenkins: 2.346.3
OS: Linux - 3.10.0-1160.99.1.el7.x86_64
Java: 1.8.0_345 - Temurin (OpenJDK 64-Bit Server VM)

ace-editor:1.1
ant:481.v7b_09e538fcca
antisamy-markup-formatter:159.v25b_c67cd35fb_
apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61
artifactory:3.18.12
authentication-tokens:1.4
authorize-project:1.4.0
bootstrap5-api:5.2.1-3
bouncycastle-api:2.27
branch-api:2.1071.v1a_188a_562481
build-timeout:1.24
caffeine-api:2.9.3-65.v6a_47d0f4d1fe
checks-api:1.8.1
cloudbees-folder:6.740.ve4f4ffa_dea_54
command-launcher:1.2
commons-lang3-api:3.12.0-36.vd97de6465d5b_
commons-text-api:1.10.0-27.vb_fa_3896786a_7
conditional-buildstep:1.4.2
config-file-provider:3.11.1
configuration-as-code:1569.vb_72405b_80249
credentials:1143.vb_e8b_b_ceee347
credentials-binding:523.525.vb_72269281873
dashboard-view:2.466.vdfefd95a_b_f8d
display-url-api:2.3.6
docker-commons:1.21
docker-java-api:3.2.13-37.vf3411c9828b9
docker-plugin:1.3.0
docker-workflow:563.vd5d2e5c4007f
durable-task:507.v050055d0cb_dd
echarts-api:5.4.0-1
email-ext:2.92
extra-columns:1.25
font-awesome-api:6.2.1-1
git:4.14.3
git-client:3.13.1
github:1.34.5
github-api:1.303-400.v35c2d8258028
github-branch-source:1696.v3a_7603564d04
gradle:2.8.2
ionicons-api:31.v4757b_6987003
jackson2-api:2.14.2-319.v37853346a_229
jakarta-activation-api:2.0.1-2
jakarta-mail-api:2.0.1-2
javadoc:226.v71211feb_e7e9
javax-activation-api:1.2.0-5
javax-mail-api:1.6.2-5
jaxb:2.3.7-1
jdk-tool:1.0
jjwt-api:0.11.5-77.v646c772fddb_0
job-dsl:1.81.1
jquery3-api:3.6.1-2
jsch:0.2.8-65.v052c39de79b_2
junit:1166.1168.vd6b_8042a_06de
ldap:659.v8ca_b_a_fe79fa_d
mailer:435.438.v5b_81173f5b_a_1
matrix-auth:3.1.5
matrix-project:772.v494f19991984
maven-plugin:3.22
momentjs:1.1.1
okhttp-api:4.9.3-108.v0feda04578cf
pam-auth:1.10
pipeline-build-step:488.v8993df156e8d
pipeline-github-lib:38.v445716ea_edda_
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:629.vb_5627b_ee2104
pipeline-input-step:466.v6d0a_5df34f81
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2121.vd87fb_6536d1e
pipeline-model-definition:2.2121.vd87fb_6536d1e
pipeline-model-extensions:2.2121.vd87fb_6536d1e
pipeline-rest-api:2.28
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2121.vd87fb_6536d1e
pipeline-stage-view:2.28
pipeline-utility-steps:2.15.0
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:2.20.0
popper2-api:2.11.6-2
resource-disposer:0.20
run-condition:1.5
scm-api:631.v9143df5b_e4a_a
script-security:1229.v4880b_b_e905a_6
snakeyaml-api:1.33-90.v80dcb_3814d35
ssh-credentials:305.v8f4381501156
ssh-slaves:1.834.v622da_57f702c
sshd:3.0.3
structs:324.va_f5d6774f3a_d
tfs:5.157.1-SNAPSHOT (private-2163c3ae-gilad)
timestamper:1.21
token-macro:321.vd7cc1f2a_52c8
trilead-api:1.67.vc3938a_35172f
variant:59.vf075fe829ccb
workflow-aggregator:596.v8c21c963d92d
workflow-api:1200.v8005c684b_a_c6
workflow-basic-steps:994.vd57e3ca_46d24
workflow-cps:3536.vb_8a_6628079d5
workflow-durable-task-step:1217.v38306d8fa_b_5c
workflow-job:1207.1209.v69351208a_5a_7
workflow-multibranch:716.vc692a_e52371b_
workflow-scm-step:408.v7d5b_135a_b_d49
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c
ws-cleanup:0.43

Version 2.346.3 is almost 2 years old. The plugin center only supports versions that are not older than 1 year approximately.
You can still run this Jenkins version but you need to install plugins manually to ensure you get the right versions.
But I would look into updating Jenkins as there are security vulnerabilities for that version.

Thanks, I know I should update jenkins, but that also requires updating all the agents and it costs time, so I need permission from my company.

However, it is strange that is redirected to the latest version instead of returning ko.

Any other ideas?

It needs to return something and the decision was to return the latest still supported information.
afaik you can explicitly specify the version you want in the plugins.txt used by jenkins-plugin-cli

You could also setup your own update center that collects the info for you version but that is quite complex and requires a lot of work.

Yes, I have already done it.

Thanks