mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-02 21:32:57 +02:00
let's return errors when warming a cache (#553)
* let's return errors when warming a cache * Fix lint error in warm.go
This commit is contained in:
Vendored
+5
-7
@@ -37,25 +37,23 @@ func WarmCache(opts *config.WarmerOptions) error {
|
||||
for _, image := range images {
|
||||
cacheRef, err := name.NewTag(image, name.WeakValidation)
|
||||
if err != nil {
|
||||
errors.Wrap(err, fmt.Sprintf("Failed to verify image name: %s", image))
|
||||
return errors.Wrap(err, fmt.Sprintf("Failed to verify image name: %s", image))
|
||||
}
|
||||
img, err := remote.Image(cacheRef)
|
||||
if err != nil {
|
||||
errors.Wrap(err, fmt.Sprintf("Failed to retrieve image: %s", image))
|
||||
return errors.Wrap(err, fmt.Sprintf("Failed to retrieve image: %s", image))
|
||||
}
|
||||
|
||||
digest, err := img.Digest()
|
||||
if err != nil {
|
||||
errors.Wrap(err, fmt.Sprintf("Failed to retrieve digest: %s", image))
|
||||
return errors.Wrap(err, fmt.Sprintf("Failed to retrieve digest: %s", image))
|
||||
}
|
||||
cachePath := path.Join(cacheDir, digest.String())
|
||||
err = tarball.WriteToFile(cachePath, cacheRef, img)
|
||||
if err != nil {
|
||||
errors.Wrap(err, fmt.Sprintf("Failed to write %s to cache", image))
|
||||
} else {
|
||||
logrus.Debugf("Wrote %s to cache", image)
|
||||
return errors.Wrap(err, fmt.Sprintf("Failed to write %s to cache", image))
|
||||
}
|
||||
|
||||
logrus.Debugf("Wrote %s to cache", image)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user