From 2f8d939b3fd667882466baf148699bf6be295647 Mon Sep 17 00:00:00 2001 From: ejose19 <8742215+ejose19@users.noreply.github.com> Date: Fri, 30 Oct 2020 03:46:00 -0300 Subject: [PATCH] fix: CheckPushPermissions not being called when CacheRepo was set (#1471) --- cmd/executor/cmd/root.go | 2 +- pkg/executor/push.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/executor/cmd/root.go b/cmd/executor/cmd/root.go index 8bd40b3ce3..68b552da0e 100644 --- a/cmd/executor/cmd/root.go +++ b/cmd/executor/cmd/root.go @@ -95,7 +95,7 @@ var RootCmd = &cobra.Command{ } logrus.Warn("kaniko is being run outside of a container. This can have dangerous effects on your system") } - if !opts.NoPush { + if !opts.NoPush || opts.CacheRepo != "" { if err := executor.CheckPushPermissions(opts); err != nil { exit(errors.Wrap(err, "error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again")) } diff --git a/pkg/executor/push.go b/pkg/executor/push.go index a425ba30af..f4bda69799 100644 --- a/pkg/executor/push.go +++ b/pkg/executor/push.go @@ -102,7 +102,7 @@ var ( // CheckPushPermissions checks that the configured credentials can be used to // push to every specified destination. func CheckPushPermissions(opts *config.KanikoOptions) error { - var targets = opts.Destinations + targets := opts.Destinations // When no push is set, whe want to check permissions for the cache repo // instead of the destinations if opts.NoPush {