From d65b9b54183bccfb261226cc82901503b7b9c113 Mon Sep 17 00:00:00 2001 From: Samarth08 Date: Tue, 14 May 2024 05:43:55 +0530 Subject: [PATCH] "fix: resolve issue where cache layers would be pushed if --no-push was specified" (#3132) --- pkg/executor/push.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/executor/push.go b/pkg/executor/push.go index c95aecc351..87da3b090d 100644 --- a/pkg/executor/push.go +++ b/pkg/executor/push.go @@ -398,8 +398,8 @@ func pushLayerToCache(opts *config.KanikoOptions, cacheKey string, tarPath strin return errors.Wrap(err, "appending layer onto empty image") } cacheOpts := *opts - cacheOpts.TarPath = "" // tarPath doesn't make sense for Docker layers - cacheOpts.NoPush = false // we want to push cached layers + cacheOpts.TarPath = "" // tarPath doesn't make sense for Docker layers + cacheOpts.NoPush = opts.NoPush // we don't want to push cached layers if no push is specified cacheOpts.Destinations = []string{cache} cacheOpts.InsecureRegistries = opts.InsecureRegistries cacheOpts.SkipTLSVerifyRegistries = opts.SkipTLSVerifyRegistries