From 4b7e2b3a064fe0d558d2a87173bc50e7de31f441 Mon Sep 17 00:00:00 2001 From: dlorenc Date: Thu, 21 Feb 2019 14:09:22 -0600 Subject: [PATCH] Update the cache warmer to also save manifests. (#576) --- pkg/cache/warm.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/cache/warm.go b/pkg/cache/warm.go index 02bb550fe..c03746e0b 100644 --- a/pkg/cache/warm.go +++ b/pkg/cache/warm.go @@ -18,6 +18,7 @@ package cache import ( "fmt" + "io/ioutil" "path" "github.com/GoogleContainerTools/kaniko/pkg/config" @@ -53,6 +54,15 @@ func WarmCache(opts *config.WarmerOptions) error { if err != nil { return errors.Wrap(err, fmt.Sprintf("Failed to write %s to cache", image)) } + + mfst, err := img.RawManifest() + if err != nil { + return errors.Wrap(err, fmt.Sprintf("Failed to retrieve manifest for %s", image)) + } + mfstPath := cachePath + ".json" + if err := ioutil.WriteFile(mfstPath, mfst, 0666); err != nil { + return errors.Wrap(err, fmt.Sprintf("Failed to save manifest for %s", image)) + } logrus.Debugf("Wrote %s to cache", image) } return nil