Fix implicit GCR auth (#1856)

* Fix implicit GCR auth

* boilerplate
This commit is contained in:
Jason Hall
2021-12-28 20:34:32 -05:00
committed by GitHub
parent 129df249c9
commit 633f555c5c
12 changed files with 693 additions and 60 deletions
-8
View File
@@ -95,14 +95,6 @@ func CheckPushPermissions(opts *config.KanikoOptions) error {
}
registryName := destRef.Repository.Registry.Name()
// Historically kaniko was pre-configured by default with gcr credential helper,
// in here we keep the backwards compatibility by enabling the GCR helper only
// when gcr.io (or pkg.dev) is in one of the destinations.
if registryName == "gcr.io" || strings.HasSuffix(registryName, ".gcr.io") || strings.HasSuffix(registryName, ".pkg.dev") {
if err := util.ConfigureGCR(fmt.Sprintf("--registries=%s", registryName)); err != nil {
return err
}
}
if opts.Insecure || opts.InsecureRegistries.Contains(registryName) {
newReg, err := name.NewRegistry(registryName, name.WeakValidation, name.Insecure)
if err != nil {