jenkinsci / docker-plugin

Jenkins cloud plugin that uses Docker
https://plugins.jenkins.io/docker-plugin/
MIT License
490 stars 319 forks source link

Newer httpclient 5 API breaks tests of the docker plugin #1103

Open MarkEWaite opened 1 month ago

MarkEWaite commented 1 month ago

Jenkins and plugins versions report

Environment summary

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

Ubuntu 22.04 and Debian without Docker listening on port 2375 fails tests when testing with apache-httpcomponents-client-5-api 5.4-118.v199115451c4d . The same tests pass if tested with apache-httpcomponents-client-5-api 5.3.1-110.v77252fb_d4da_5

Ubuntu 22.04 and Debian with Docker listening on port 2375 passes tests with both versions of apache-httpcomponents-client-5-api

Reproduction steps

  1. Run tests on ci.jenkins.io or on a local computer that does not have a Docker listener on port 2375, confirm tests fail unless the apache-httpcomponents-client-5-api library used in the test is forced to 5.3.1-110.v77252fb_d4da_5

Expected Results

Tests should pass with both the older and the newer version of the apache-httpcomponents-client-5-api library

Actual Results

Test fail unexpectedly unless a Docker listener is available on port 2375

Anything else?

Failure seems to be specific to the tests. Assumed that there is some difference in exception handling between the two versions of the apache-httpcomponents-client-5-api library.

Are you interested in contributing a fix?

Yes, though not sure when time will allow it. A temporary workaround has been applied in:

MarkEWaite commented 1 month ago

@krisstern I'm truly surprised by this failure, but did not want to block the update to the most recent plugin bill of materials. I've assigned it to myself, but I'm not yet sure when I will have time to investigate it.

kirk-fitzsimons commented 1 month ago

I am getting failing tests locally on latest

[ERROR] Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 9.096 s <<< FAILURE! -- in io.jenkins.docker.client.ConfigurationAsCodeTest [ERROR] io.jenkins.docker.client.ConfigurationAsCodeTest.should_support_old_configuration -- Time elapsed: 7.548 s <<< FAILURE! java.lang.AssertionError: Unexpected exception at io.jenkins.plugins.casc.misc.JenkinsConfiguredWithCodeRule.before(JenkinsConfiguredWithCodeRule.java:50) at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:649) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: io.jenkins.plugins.casc.UnknownAttributesException: cloud: No hudson.slaves.Cloud implementation found for docker at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$lookupDescriptor$12(HeteroDescribableConfigurator.java:236) at io.vavr.control.Option.orElse(Option.java:321) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lookupDescriptor(HeteroDescribableConfigurator.java:227) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:86) at io.vavr.Tuple2.apply(Tuple2.java:238) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:86) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.check(HeteroDescribableConfigurator.java:94) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.check(HeteroDescribableConfigurator.java:57) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:355) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:293) at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$9(ConfigurationAsCode.java:834) at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:777) at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:834) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:820) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:699) at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:668) at io.jenkins.plugins.casc.misc.JenkinsConfiguredWithCodeRule.before(JenkinsConfiguredWithCodeRule.java:47) ... 3 more

Env: Windows 10 OpenJDK Runtime Environment Temurin-17.0.12+7

MarkEWaite commented 1 month ago

I am getting failing tests locally on latest

Env: Windows 10 OpenJDK Runtime Environment Temurin-17.0.12+7

Any guess about what is different between your Windows computer and the Windows agent on ci.jenkins.io where the tests pass?

kirk-fitzsimons commented 1 month ago

I am getting failing tests locally on latest Env: Windows 10 OpenJDK Runtime Environment Temurin-17.0.12+7

Any guess about what is different between your Windows computer and the Windows agent on ci.jenkins.io where the tests pass?

Not sure:

PS C:\Users\fitzsimok\dev\docker-plugin> mvn clean verify -X Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256) Maven home: C:\apache-maven-3.9.8 Java version: 17.0.12, vendor: Eclipse Adoptium, runtime: C:\Program Files\Eclipse Adoptium\jdk-17.0.12.7-hotspot Default locale: en_US, platform encoding: Cp1252 OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

kirk-fitz commented 1 month ago

Hit the same error in wsl(ubuntu) on the same host

Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256) Maven home: /mnt/c/apache-maven-3.9.8 Java version: 17.0.12, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-17-jdk-amd64 Default locale: en, platform encoding: UTF-8 OS name: "linux", version: "5.15.153.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"

kirk-fitz commented 1 month ago

I thought it might be an issue with my env on company laptop, but I ran on my personal laptop, with same version of java and maven,

PS C:\Users\Kirk\git\docker-plugin> mvn install -X Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256) Maven home: C:\ProgramData\chocolatey\lib\maven\apache-maven-3.9.8 Java version: 17.0.12, vendor: Eclipse Adoptium, runtime: C:\Program Files\Eclipse Adoptium\jdk-17.0.12.7-hotspot Default locale: en_IE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

and have reproduced the issue with the tests, also when i run mvn hpi:run docker does not show up as a cloud even though the plugin is installed...

Image

Image

MarkEWaite commented 1 month ago

I thought it might be an issue with my env on company laptop, but I ran on my personal laptop, with same version of java and maven,

I'm not sure that anyone has attempted to use the docker plugin as a cloud provider on a Windows installation of Docker. I use it with a Linux host that runs Docker. The Windows agents on ci.jenkins.io may not have Docker installed or they may have Docker installed and configured in such a way that the tests in the plugin are skipped. Your Docker configuration on Windows may be different enough from the ci.jenkins.io agents that the tests are not skipped.

kirk-fitz commented 1 month ago

I wasn't able to figure out the root cause of the issue, but I was able to get the test to run on a ubuntu vm, the reason I wanted to get the plugin/test working was to try and address this issue https://github.com/jenkinsci/docker-plugin/issues/1104, I have created a PR which i believe addresses the issue, but cant fully test it. I am hoping someone else can. https://github.com/jenkinsci/docker-plugin/pull/1105

On Sat, Oct 5, 2024 at 12:44 AM Mark Waite @.***> wrote:

I thought it might be an issue with my env on company laptop, but I ran on my personal laptop, with same version of java and maven,

I'm not sure that anyone has attempted to use the docker plugin as a cloud provider on a Windows installation of Docker. I use it with a Linux host that runs Docker. The Windows agents on ci.jenkins.io may not have Docker installed or they may have Docker installed and configured in such a way that the tests in the plugin are skipped. Your Docker configuration on Windows may be different enough from the ci.jenkins.io agents that the tests are not skipped.

— Reply to this email directly, view it on GitHub https://github.com/jenkinsci/docker-plugin/issues/1103#issuecomment-2394794001, or unsubscribe https://github.com/notifications/unsubscribe-auth/BKA4AWEOQRT7XUYIUUTKHCDZZ4R6RAVCNFSM6AAAAABPGPRX6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJUG44TIMBQGE . You are receiving this because you commented.Message ID: @.***>

MarkEWaite commented 1 month ago

A new 5.4-124.v31e2987e48f4 release of Apache httpcomponents client 5 API is available that switches the library back to httpclient 5.3.1 while retaining the version number "5.4" in the version string.