More logging to debug path issues
parent
50f132be0a
commit
3b198d19d6
|
@ -25,6 +25,7 @@ import (
|
|||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/google/go-containerregistry/pkg/authn"
|
||||
|
@ -77,6 +78,7 @@ func CacheImages(images []string, cacheDir string) error {
|
|||
if err := CacheImage(image, dst); err != nil {
|
||||
return errors.Wrapf(err, "caching image %s", dst)
|
||||
}
|
||||
glog.Infof("CacheImage %s -> %s succeeded", image, dst)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
@ -143,7 +145,9 @@ func CacheAndLoadImages(images []string) error {
|
|||
func sanitizeCacheDir(image string) string {
|
||||
if runtime.GOOS == "windows" && hasWindowsDriveLetter(image) {
|
||||
// not sanitize Windows drive letter.
|
||||
return image[:2] + strings.Replace(image[2:], ":", "_", -1)
|
||||
s := image[:2] + strings.Replace(image[2:], ":", "_", -1)
|
||||
glog.Infof("windows sanitize: %s -> %s", image, s)
|
||||
return s
|
||||
}
|
||||
return strings.Replace(image, ":", "_", -1)
|
||||
}
|
||||
|
@ -286,8 +290,14 @@ func getDstPath(dst string) (string, error) {
|
|||
|
||||
// CacheImage caches an image
|
||||
func CacheImage(image, dst string) error {
|
||||
glog.Infof("Attempting to cache image: %s at %s\n", image, dst)
|
||||
start := time.Now()
|
||||
glog.Infof("CacheImage: %s -> %s", image, dst)
|
||||
defer func() {
|
||||
glog.Infof("CacheImage: %s -> %s completed in %s", image, dst, time.Since(start))
|
||||
}()
|
||||
|
||||
if _, err := os.Stat(dst); err == nil {
|
||||
glog.Infof("%s exists", dst)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -331,6 +341,7 @@ func CacheImage(image, dst string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
glog.Infof("%s exists", dst)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue