Update the cache warmer to also save manifests. (#576)
This commit is contained in:
parent
94d7db884b
commit
4b7e2b3a06
|
|
@ -18,6 +18,7 @@ package cache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
"github.com/GoogleContainerTools/kaniko/pkg/config"
|
"github.com/GoogleContainerTools/kaniko/pkg/config"
|
||||||
|
|
@ -53,6 +54,15 @@ func WarmCache(opts *config.WarmerOptions) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, fmt.Sprintf("Failed to write %s to cache", image))
|
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)
|
logrus.Debugf("Wrote %s to cache", image)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue