-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🧹 Refactor auth opts for registries. Pass through opts when pulling registry images #3738
Conversation
abef6d0
to
300c9cb
Compare
Test Results2 971 tests ±0 2 970 ✅ ±0 1m 28s ⏱️ -1s Results for commit 37fb5db. ± Comparison against base commit 46664a5. This pull request removes 3 and adds 3 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
300c9cb
to
1e84b68
Compare
…g registry images. Signed-off-by: Preslav <[email protected]>
1e84b68
to
315c363
Compare
@@ -50,12 +47,11 @@ func (r *Resolver) Resolve(ctx context.Context, root *inventory.Asset, conf *inv | |||
if err == nil { | |||
log.Debug().Str("image", conf.Host).Msg("detected container image in container registry") | |||
|
|||
remoteOpts := AuthOption(conf.Credentials, credsResolver) | |||
// we need to disable default keychain auth if an auth method was found | |||
if len(remoteOpts) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was redundant, if we ensure that the auth opt always returns then we dont need the DisableKeychainAuth
since we can have the AuthOption
decide whats the best auth method by looking at the creds
@@ -164,7 +121,7 @@ func (a *DockerRegistryImages) ListRepository(repoName string) ([]*inventory.Ass | |||
return nil, fmt.Errorf("parsing reference %q: %v", repoWithTag, err) | |||
} | |||
|
|||
a, err := a.toAsset(ref, nil) | |||
a, err := a.toAsset(ref, nil, opts...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass opts thru to ensure these are respected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice cleanup
remote.Options
code toauth/options