Skip to content

Fix Docker Auth config to be platform agnostic

What does this MR do?

A new test was added in !2024 (merged) that tests how we read our Docker auth config from known Docker directories.

When running this test on Windows we see it fails because we use path.Join which is specific for Unix instead of filepath.

Why was this MR needed?

master:broken for Windows https://gitlab.com/gitlab-org/gitlab-runner/-/jobs/544032159

Testing

config read on Linux
Running with gitlab-runner development version (HEAD)
   on docker fL_5iHR7
Preparing the "docker" executor
00:06
 Using Docker executor with image registry.gitlab.com/steveazz/playground-private:latest ...
 Authenticating with credentials from /Users/steve/.docker/config.json
 Using locally found image version due to if-not-present pull policy
 Using docker image sha256:2db3c0e895a3614ed392d48079b589c77cbb9a71edc9f403e5a6f80423270f94 for gitlab/gitlab-runner-helper:x86_64-4c96e5ad ...
 Authenticating with credentials from /Users/steve/.docker/config.json
 Pulling docker image registry.gitlab.com/steveazz/playground-private:latest ...
 Using docker image sha256:407d9e3a278a91b57e5c233c1d827137f24cb467658361acfdcaa5485bad5b03 for registry.gitlab.com/steveazz/playground-private:latest ...
Config read on Windows
 Running with gitlab-runner 13.0.0~beta.131.gb0c51cf2 (b0c51cf2)
   on windows-docker LnGUusC8
Preparing the "docker-windows" executor
00:00
 Using Docker executor with image steveazz ...
 Authenticating with credentials from C:\Users\Administrator\.docker\config.json
 Using locally found image version due to if-not-present pull policy
 Using docker image sha256:bdc4ebbad3c1c642bdeaaa516c4e0d9690df6494f71ee61951e2546fc7f313a6 for gitlab/gitlab-runner-helper:x86_64-4c96e5ad-servercore1809 ...
 Authenticating with credentials from C:\Users\Administrator\.docker\config.json
 Using locally found image version due to if-not-present pull policy
 Using docker image sha256:52925dc1b265efac26bf6788d50d6369f8cfc4441737458c874ee027226592dd for steveazz ...
Preparing environment
 Authenticating with credentials from C:\Users\Administrator\.docker\config.json
 Authenticating with credentials from C:\Users\Administrator\.docker\config.json

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

Closes #25585 (closed)

Merge request reports