feat(image): introduce WithCredentials* to select how pull credentials are retrieved#82
Merged
mdelapenya merged 2 commits intodocker:mainfrom Oct 3, 2025
Merged
Conversation
141fa25 to
beebe0d
Compare
mdelapenya
reviewed
Jul 28, 2025
beebe0d to
30ffead
Compare
30ffead to
3b09f70
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a generic credentials function mechanism to make the credential retrieval process pluggable for Docker image pull operations. The change replaces the hardcoded Docker CLI config credential lookup with a configurable function, enabling alternative credential resolution mechanisms.
- Adds a configurable
credentialsFnfield topullOptionsstruct for credential retrieval - Introduces
WithCredentialsFnoption to set custom credential functions - Moves existing config-based credential logic to
WithCredentialsFromConfigfunction - Sets
WithCredentialsFromConfigas the default when no custom credential function is provided
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| image/pull.go | Replaces direct config-based auth logic with pluggable credential function calls |
| image/options.go | Adds credential function field and new option functions for configuration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
410ada9 to
0680a59
Compare
…s are retrieved Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
0680a59 to
4a0b532
Compare
mdelapenya
approved these changes
Oct 3, 2025
Member
mdelapenya
left a comment
There was a problem hiding this comment.
I added some unit tests, other than that LGTM!! 🙇
Will merge it as soon as the CI passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
introduce a generic
credentialsFnto retrieve credentials for pull operationoffers
WithCredentialsFromConfigto get credentials from docker/cli config (current mechanism)this makes it possible to plug an alternative func that can resolve credentials from a TBD mechanism use by the docker/cli after cli/config cleanup (see discussion on docker/cli#6210), as storing credentials in config is not the desired way.
This mkes
legacyadapterto convert docker/cli Config <-> go-sdk/config useless as (AFAICT) it is only used by Pull operation to retrieve username/password. Here we model this requirement as a minimal lookup method.