From c3de94a5f3d1da4ddcb89e5065760989bd7501fe Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Tue, 22 Feb 2022 11:17:01 -0500 Subject: [PATCH] Avoid overwriting user defined registry options When defining default registry options, prepend them to the list of existing options rather than append. Within GGCR when the options are collected, items later in the list supersede items earlier in the list. Signed-off-by: Scott Andrews --- pkg/imgpkg/registry/registry.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/imgpkg/registry/registry.go b/pkg/imgpkg/registry/registry.go index 888f2971a..4d5cf2588 100644 --- a/pkg/imgpkg/registry/registry.go +++ b/pkg/imgpkg/registry/registry.go @@ -157,7 +157,8 @@ func (r SimpleRegistry) CloneWithSingleAuth(imageRef regname.Tag) (Registry, err // opts Returns the opts + the keychain func (r SimpleRegistry) opts() []regremote.Option { - return append(r.remoteOpts, regremote.WithAuthFromKeychain(r.keychain)) + // new options come first so that user configured options take precedence + return append([]regremote.Option{regremote.WithAuthFromKeychain(r.keychain)}, r.remoteOpts...) } // Get Retrieve Image descriptor for an Image reference