Skip to content

Issue 26494: Support organizations in DOCKER_AUTH_CONFIG

Ferenc Hechler requested to merge glferi/gitlab-runner:main into main
  • Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA

What does this MR do?

It fulfills the Feature Request #26494.

Defining "DOCKER_AUTH_CONFIG" in CI/CD variables allows pulling pipeline images from docker registries which need authentication. Multiple authentications can be defined in the json structure. The method ResolveConfigForImage in "helpers/docker/auth/auth.go" parses the json structure and if a matching hostname is found returns the neccessary credentials.

The resolver only looks at the hostname to decide, which entry matches and which not. But there are docker registries, which support organizations. E.g. "https://host.name/orga1" needs different credentials from "https://host.name/orga2".

The resolver was improved in that way, that it selects the longest matching path (split at "/") if there are multiple matches.

Why was this MR needed?

Allow configuring different credentials per organization for the same docker registry. Details are described in the issue #26494

What's the best way to test this MR?

Additional testscases for organizations where added to "helpers/docker/auth/auth_test.go".

What are the relevant issue numbers?

Issue #26494

Edited by Ferenc Hechler

Merge request reports

Loading