jenkinsci / docker-plugin

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

Windows container started by the plugin shows values of WORKSPACE and WORKSPACE_TMP environment variables in Linux format #1117

Open andreasgk16 opened 3 days ago

andreasgk16 commented 3 days ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.462.3 OS: Linux - 5.15.0-301.163.5.2.el9uek.x86_64 Java: 11.0.25 - Red Hat, Inc. (OpenJDK 64-Bit Server VM) --- Office-365-Connector:5.0.0 Parameterized-Remote-Trigger:3.2.0 allure-jenkins-plugin:2.31.1 analysis-model-api:12.9.1 ansicolor:1.0.5 ant:511.v0a_a_1a_334f41b_ antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 apache-httpcomponents-client-5-api:5.4-124.v31e2987e48f4 appaloosa-plugin:1.4.12 asm-api:9.7.1-97.v4cc844130d97 atlassian-bitbucket-server-integration:4.1.1 authentication-tokens:1.119.v50285141b_7e1 authorize-project:1.8.1 azure-ad:531.v13107da_f2635 azure-credentials:312.v0f3973cd1e59 azure-sdk:184.v1f2c161c9777 badge:2.3 basic-branch-build-strategies:81.v05e333931c7d bitbucket:254.v9d8ec33a_7a_42 blackduck-detect:10.0.0 blueocean:1.27.16 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.27.16 blueocean-commons:1.27.16 blueocean-config:1.27.16 blueocean-core-js:1.27.16 blueocean-dashboard:1.27.16 blueocean-display-url:2.4.3 blueocean-events:1.27.16 blueocean-git-pipeline:1.27.16 blueocean-github-pipeline:1.27.16 blueocean-i18n:1.27.16 blueocean-jira:1.27.16 blueocean-jwt:1.27.16 blueocean-personalization:1.27.16 blueocean-pipeline-api-impl:1.27.16 blueocean-pipeline-editor:1.27.16 blueocean-pipeline-scm-api:1.27.16 blueocean-rest:1.27.16 blueocean-rest-impl:1.27.16 blueocean-web:1.27.16 bootstrap5-api:5.3.3-1 bouncycastle-api:2.30.1.78.1-248.ve27176eb_46cb_ branch-api:2.1200.v4b_a_3da_2eb_db_4 build-blocker-plugin:166.vc82fc20b_a_ed6 build-failure-analyzer:2.5.2 build-name-setter:2.4.3 build-timeout:1.33 build-timestamp:1.0.4 build-user-vars-plugin:176.vb_9c7907fd524 buildtriggerbadge:251.vdf6ef853f3f5 built-on-column:1.4 caffeine-api:3.1.8-133.v17b_1ff2e0599 checks-api:2.2.1 cloud-stats:336.v788e4055508b_ cloudbees-bitbucket-branch-source:912.v3b_f74026941c cloudbees-folder:6.955.v81e2a_35c08d3 clover:4.14.2.596.vb_4d6475e990b_ command-launcher:116.vd85919c54a_d6 commons-compress-api:1.26.1-2 commons-httpclient3-api:3.1-3 commons-lang3-api:3.17.0-84.vb_b_938040b_078 commons-text-api:1.12.0-129.v99a_50df237f7 compress-buildlog:1.2 conditional-buildstep:1.4.3 config-file-provider:980.v88956a_a_5d6a_d copyartifact:757.v05365583a_455 coverage:1.16.1 credentials:1384.vf0a_2ed06f9c6 credentials-binding:681.vf91669a_32e45 cucumber-reports:5.8.4-test custom-checkbox-parameter:1.4 dark-theme:479.v661b_1b_911c01 dashboard-view:2.521.v339b_a_f4d8da_8 data-tables-api:2.1.8-1 description-setter:239.vd0a_6b_785f92d display-url-api:2.204.vf6fddd8a_8b_e9 docker-commons:445.v6b_646c962a_94 docker-java-api:3.4.0-94.v65ced49b_a_7d5 docker-plugin:1.7.0 docker-workflow:580.vc0c340686b_54 dtkit-api:3.0.2 durable-task:577.v2a_8a_4b_7c0247 echarts-api:5.5.1-4 eddsa-api:0.3.0-4.v84c6f0f4969e email-ext:1849.v6dd03b_f6e423 embeddable-build-status:487.va_0ef04c898a_2 envinject:2.919.v009a_a_1067cd0 envinject-api:1.199.v3ce31253ed13 extensible-choice-parameter:1.8.1 external-monitor-job:215.v2e88e894db_f8 extra-columns:1.26 favorite:2.221.v19ca_666b_62f5 file-operations:321.vd98ef0161b_7e file-parameters:339.v4b_cc83e11455 folder-properties:1.2.1 font-awesome-api:6.6.0-2 forensics-api:2.6.0 generic-webhook-trigger:2.2.5 git:5.5.2 git-changelog:3.39 git-client:5.0.0 git-forensics:2.2.1 git-parameter:0.10.0 git-server:126.v0d945d8d2b_39 github:1.40.0 github-api:1.321-468.v6a_9f5f2d5a_7e github-branch-source:1807.v50351eb_7dd13 golang:1.4 google-oauth-plugin:1.330.vf5e86021cb_ec gradle:2.13.1 groovy:457.v99900cb_85593 groovy-postbuild:267.va_df06de9fa_fa_ gson-api:2.11.0-85.v1f4e87273c33 handy-uri-templates-2-api:2.1.8-30.v7e777411b_148 hidden-parameter:366.v7024b_32e399e htmlpublisher:1.37 http_request:1.19 instance-identity:201.vd2a_b_5a_468a_a_6 ionicons-api:74.v93d5eb_813d5f jackson2-api:2.17.0-379.v02de8ec9f64c jakarta-activation-api:2.1.3-1 jakarta-mail-api:2.1.3-1 javadoc:280.v050b_5c849f69 javax-activation-api:1.2.0-7 javax-mail-api:1.6.2-10 jaxb:2.3.9-1 jdk-tool:80.v8a_dee33ed6f0 jenkins-design-language:1.27.16 jersey2-api:2.44-151.v6df377fff741 jira:3.13 jira-steps:2.0.165.v8846cf59f3db jjwt-api:0.11.5-112.ve82dfb_224b_a_d jnr-posix-api:3.1.19-2 job-dsl:1.89 job-import-plugin:3.6 jobConfigHistory:1283.veb_dfb_00b_5ec0 jobcopy-builder:1.5.0 joda-time-api:2.13.0-93.v9934da_29b_a_e9 jquery:1.12.4-3 jquery3-api:3.7.1-2 jsch:0.2.16-86.v42e010d9484b_ json-api:20240303-101.v7a_8666713110 json-path-api:2.9.0-118.v7f23ed82a_8b_8 junit:1309.v0078b_fecd6ed ldap:725.v3cb_b_711b_1a_ef leastload:62.vfa_8830902733 lockable-resources:1327.ved786b_a_197e0 log-parser:2.3.5 mail-watcher-plugin:1.19 mailer:488.v0c9639c1a_eb_3 mapdb-api:1.0.9-40.v58107308b_7a_7 mask-passwords:173.v6a_077a_291eb_5 matrix-auth:3.2.3 matrix-project:839.vff91cd7e3a_b_2 maven-artifact-choicelistprovider:1.17 maven-plugin:3.24 mercurial:1260.vdfb_723cdcc81 metrics:4.2.21-458.vcf496cb_839e4 mina-sshd-api-common:2.14.0-133.vcc091215a_358 mina-sshd-api-core:2.14.0-133.vcc091215a_358 monitoring:1.99.0 msbuild:1.35 mstest:1.0.5 multibranch-build-strategy-extension:51.v88f14e2a_4075 multibranch-scan-webhook-trigger:1.0.11 naginator:1.481.vcb_b_384a_3de89 nant:248.vcc8a_3eec8db_a next-build-number:66.v4b_4762172d53 nexus-artifact-uploader:2.14 nexus-jenkins-plugin:3.20.6-01 node-iterator-api:55.v3b_77d4032326 nodelabelparameter:1.13.0 nunit:547.v9dcdd7a_90848 oauth-credentials:0.653.v14cf2088e950 okhttp-api:4.11.0-172.vda_da_1feeb_c6e pam-auth:1.11 parameter-separator:250.va_6292fd7f47b_ parameterized-scheduler:277.v61a_4b_a_49a_c5c parameterized-trigger:806.vf6fff3e28c3e performance:962.v95a_4913d332e pipeline-build-step:540.vb_e8849e1a_b_d8 pipeline-github-lib:61.v629f2cc41d83 pipeline-graph-analysis:216.vfd8b_ece330ca_ pipeline-groovy-lib:744.v5b_556ee7c253 pipeline-input-step:495.ve9c153f6067b_ pipeline-milestone-step:119.vdfdc43fc3b_9a_ pipeline-model-api:2.2218.v56d0cda_37c72 pipeline-model-definition:2.2218.v56d0cda_37c72 pipeline-model-extensions:2.2218.v56d0cda_37c72 pipeline-rest-api:2.34 pipeline-stage-step:312.v8cd10304c27a_ pipeline-stage-tags-metadata:2.2218.v56d0cda_37c72 pipeline-stage-view:2.34 pipeline-utility-steps:2.18.0 plain-credentials:183.va_de8f1dd5a_2b_ plugin-usage-plugin:4.8 plugin-util-api:5.1.0 powershell:2.2 prism-api:1.29.0-18 prometheus:795.v995762102f28 pubsub-light:1.18 rebuild:332.va_1ee476d8f6d remote-file:1.24 resource-disposer:0.24 run-condition:1.7 saml:4.464.vea_cb_75d7f5e0 scm-api:696.v778d637b_a_762 script-security:1369.v9b_98a_4e95b_2d signtool-jenkins-plugin:0.3 snakeyaml-api:2.3-123.v13484c65210a_ sonar:2.17.3 sse-gateway:1.27 ssh-agent:376.v8933585c69d3 ssh-credentials:343.v884f71d78167 ssh-slaves:2.973.v0fa_8c0dea_f9f sshd:3.330.vc866a_8389b_58 structs:338.v848422169819 subversion:1281.vc8837f91a_07a_ theme-manager:262.vc57ee4a_eda_5d thinBackup:2.1.1 throttle-concurrents:2.14 timestamper:1.27 token-macro:400.v35420b_922dcb_ trilead-api:2.147.vb_73cc728a_32e uno-choice:2.8.4 urltrigger:1.02 validating-string-parameter:251.vc34e592b_8a_4d variant:60.v7290fc0eb_b_cd versioncolumn:243.vda_c20eea_a_8a_f view-job-filters:392.v2c0a_4dd46909 vsphere-cloud:2.27 warnings-ng:11.12.0 workflow-aggregator:600.vb_57cdd26fdd7 workflow-api:1336.vee415d95c521 workflow-basic-steps:1058.vcb_fc1e3a_21a_9 workflow-cps:3993.v3e20a_37282f8 workflow-durable-task-step:1378.v6a_3e903058a_3 workflow-job:1436.vfa_244484591f workflow-multibranch:795.ve0cb_1f45ca_9a_ workflow-scm-step:427.v4ca_6512e7df1 workflow-step-api:678.v3ee58b_469476 workflow-support:932.vb_555de1b_a_b_94 ws-cleanup:0.47 xtrigger-api:1.0 xunit:3.1.5 ```

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

Controller: Oracle Linux 9 Agents: Windows Server 2019

Reproduction steps

  1. Create a Docker agent template on a Windows Docker host
  2. Use a Docker image in which NO working directory is explicitly set. The default is C:\
  3. Run a build job using the label defined in the above template.
  4. In the build job, execute the command 'set' to list all environment variables.

This behavior breaks some build jobs.

Expected Results

Image

Actual Results

Image

Anything else?

Btw. If the Docker container comes with a Dockerfile having WORKDIR C:\Users\ContainerAdministrator inside, then the issue does not appear.

Are you interested in contributing a fix?

No response