feat: add flag to disable pushing cache (#2038)

This commit is contained in:
Jason D'Amour
2022-05-16 12:21:26 -07:00
committed by GitHub
parent ce1fb51579
commit 872758b8b0
3 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -420,7 +420,7 @@ func (s *stageBuilder) build() error {
logrus.Debugf("build: cache key for command %v %v", command.String(), ck)
// Push layer to cache (in parallel) now along with new config file
if command.ShouldCacheOutput() {
if command.ShouldCacheOutput() && ! s.opts.NoPushCache {
cacheGroup.Go(func() error {
return s.pushLayerToCache(s.opts, ck, tarPath, command.String())
})
+6 -2
View File
@@ -78,9 +78,13 @@ var (
// push to every specified destination.
func CheckPushPermissions(opts *config.KanikoOptions) error {
targets := opts.Destinations
// When no push is set, whe want to check permissions for the cache repo
// When no push and no push cache are set, we don't need to check permissions
if opts.NoPush && opt.noPushCache {
targets = []string{}
}
// When no push is set, we want to check permissions for the cache repo
// instead of the destinations
if opts.NoPush {
else if opts.NoPush && ! opt.noPushCache {
targets = []string{opts.CacheRepo}
}