jenkinsci / plugin-installation-manager-tool

Plugin Manager CLI tool for Jenkins
MIT License
377 stars 197 forks source link

Validation for the optional dependencies fails with `2.9.0` #339

Open v1v opened 3 years ago

v1v commented 3 years ago

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
Docker

Reproduction steps

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

timja commented 3 years ago

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?

v1v commented 3 years ago

Sorry if I wasn't clear but:

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 commented 3 years ago

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

v1v commented 3 years ago

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