plugin-installation-manager-tool icon indicating copy to clipboard operation
plugin-installation-manager-tool copied to clipboard

Validation for the optional dependencies fails with `2.9.0`

Open v1v opened this issue 4 years ago • 4 comments
trafficstars

Version report

Jenkins and plugins versions report: 2.289.1-lts-jdk11

cloudbees-disk-usage-simple:0.10
opentelemetry::https://repo.jenkins-ci.org/incrementals/io/jenkins/plugins/opentelemetry/0.16-rc359.9eae24591360/opentelemetry-0.16-rc359.9eae24591360.hpi
  • What Operating System are you using (both controller, and any agents involved in the problem)?
Docker

Reproduction steps

  • Dockerfile
FROM jenkins/jenkins:2.289.1-lts-jdk11
RUN jenkins-plugin-cli --latest false --plugins cloudbees-disk-usage-simple:0.10 opentelemetry::https://github.com/jenkinsci/opentelemetry-plugin/releases/download/0.14-beta/opentelemetry-0.14-beta.hpi

Results

Expected result:

Can install the optional plugin

Actual result:

#5 8.040 Plugin prerequisite not met:
#5 8.040 Plugin opentelemetry:0.14 depends on cloudbees-disk-usage-simple:0.10;resolution, but there is an older version defined on the top level - cloudbees-disk-usage-simple:0.10
------
executor failed running [/bin/sh -c jenkins-plugin-cli --latest false --plugins cloudbees-disk-usage-simple:0.10 opentelemetry::https://github.com/jenkinsci/opentelemetry-plugin/releases/download/0.14-beta/opentelemetry-0.14-beta.hpi]: exit code: 1

While If I don't add the explicit dependency for the optional plugin cloudbees-disk-usage-simple then it works

Somehow the resolution looks suspicious

v1v avatar Jun 21 '21 16:06 v1v

I don't think that's a bug, optional dependencies still have version constraints as far as I know.

i.e. if you're going to install a plugin you have an optional extension for it needs to be at least the minimum version?

But I may be wrong @oleg-nenashev?

timja avatar Jun 21 '21 17:06 timja

Sorry if I wasn't clear but:

  • the latest version for cloudbees-disk-usage-simple is 0.10. https://github.com/jenkinsci/cloudbees-disk-usage-simple-plugin/releases
  • cloudbees-disk-usage-simple is an optional dependency for the opentelemetry https://github.com/jenkinsci/opentelemetry-plugin/blob/e6a79762e95859c50ba45c5b17da03ed7df0c5da/pom.xml#L173-L178

But there is an error with

Plugin opentelemetry:0.14 depends on cloudbees-disk-usage-simple:0.10;resolution, but there is an older version defined on the top level - cloudbees-disk-usage-simple:0.10

v1v avatar Jun 21 '21 21:06 v1v

It seems to work fine when using --latest-specified

v1v avatar Jul 09 '21 11:07 v1v

How to reproduce this?

tee -a plugins.txt <<EOF
cloudbees-disk-usage-simple:0.10
google-compute-engine
opentelemetry::https://repo.jenkins-ci.org/incrementals/io/jenkins/plugins/opentelemetry/0.17-rc383.d28294a0c63f/opentelemetry-0.17-rc383.d28294a0c63f.hpi
EOF

tee -a Dockerfile <<EOF
FROM jenkins/jenkins:lts-jdk11
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN jenkins-plugin-cli --latest false -f /usr/share/jenkins/ref/plugins.txt
EOF

docker build .

output:

 > [stage-3 3/3] RUN jenkins-plugin-cli --latest false -f /usr/share/jenkins/ref/plugins.txt:                                                                     
#7 13.90 Multiple plugin prerequisites not met:                                                                                                                   
#7 13.90 Plugin opentelemetry:0.17-rc383.d28294a0c63f depends on cloudbees-disk-usage-simple:0.10;resolution, but there is an older version defined on the top level - cloudbees-disk-usage-simple:0.10,                                                                                                                            
#7 13.90 Plugin opentelemetry:0.17-rc383.d28294a0c63f depends on cloudbees-disk-usage-simple:0.10;resolution, but there is an older version defined on the top level - cloudbees-disk-usage-simple:0.10,
#7 13.90 Plugin opentelemetry:0.17-rc383.d28294a0c63f depends on cloudbees-disk-usage-simple:0.10;resolution, but there is an older version defined on the top level - cloudbees-disk-usage-simple:0.10,
#7 13.90 Plugin opentelemetry:0.17-rc383.d28294a0c63f depends on cloudbees-disk-usage-simple:0.10;resolution, but there is an older version defined on the top level - cloudbees-disk-usage-simple:0.10,
#7 13.90 Plugin opentelemetry:0.17-rc383.d28294a0c63f depends on google-compute-engine:4.3.8;resolution, but there is an older version defined on the top level - google-compute-engine:4.3.8
------
executor failed running [/bin/sh -c jenkins-plugin-cli --latest false -f /usr/share/jenkins/ref/plugins.txt]: exit code: 1

Workaround

using the --latest-specified flag

tee -a plugins.txt <<EOF
cloudbees-disk-usage-simple:0.10
google-compute-engine
opentelemetry::https://repo.jenkins-ci.org/incrementals/io/jenkins/plugins/opentelemetry/0.17-rc383.d28294a0c63f/opentelemetry-0.17-rc383.d28294a0c63f.hpi
EOF

tee -a Dockerfile <<EOF
FROM jenkins/jenkins:lts-jdk11
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN jenkins-plugin-cli --latest false --latest-specified -f /usr/share/jenkins/ref/plugins.txt
EOF

docker build .

with output:

RUN jenkins-plugin-cli --latest false --latest-specified -f /usr/share/jenkins/ref/plugins.txt
[+] Building 21.3s (8/8) FINISHED                                                                                                                                 
 => [internal] load build definition from Dockerfile                                                                                                         0.0s
 => => transferring dockerfile: 892B                                                                                                                         0.0s
 => [internal] load .dockerignore                                                                                                                            0.0s
 => => transferring context: 2B                                                                                                                              0.0s
 => [internal] load metadata for docker.io/jenkins/jenkins:lts-jdk11                                                                                         0.0s
 => [internal] load build context                                                                                                                            0.0s
 => => transferring context: 1.09kB                                                                                                                          0.0s
 => CACHED [stage-4 1/3] FROM docker.io/jenkins/jenkins:lts-jdk11                                                                                            0.0s
 => [stage-4 2/3] COPY plugins.txt /usr/share/jenkins/ref/plugins.txt                                                                                        0.0s
 => [stage-4 3/3] RUN jenkins-plugin-cli --latest false --latest-specified -f /usr/share/jenkins/ref/plugins.txt                                            20.9s
 => exporting to image                                                                                                                                       0.3s
 => => exporting layers                                                                                                                                      0.3s
 => => writing image sha256:99f3e9d74c51630615cc430577b3a7b09e02c8a6cae14a287342e860d44ee83a                                                                 0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them

v1v avatar Jul 09 '21 11:07 v1v