Skip to content
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

image-copy-ecr: avoid spammy misleading error log when pushing to cgr.dev #210

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion image-copy-ecr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@ func handler(ctx context.Context, levent events.LambdaFunctionURLRequest) (resp
src := "cgr.dev/" + body.Repository + ":" + body.Tag
dst := filepath.Join(env.FullDstRepo, filepath.Base(body.Repository)) + ":" + body.Tag
kc := authn.NewMultiKeychain(
amazonKeychain,
// Ordering matters here, as the first keychain that can resolve the resource will be used.
// When pushing to CGR we want to try the Chainguard keychain first, since the ECR keychain
// logs a misleading error message when it's invoked for a non-ECR registry. The CGR keychain
// does not log such an error, so it's better to try it first.
cgKeychain{env.Issuer, env.Region, env.Identity},
amazonKeychain,
)
if env.ImmutableTags {
dig, err := crane.Digest(src, crane.WithAuthFromKeychain(kc))
Expand Down
Loading