Use remoteImage function when getting digest for cache

Issue #410 experienced an error with base image caching where they were
"Not Authorized" to get information for a remote image, but later were
able to download and extract the base image.

To fix this, we can switch to using the remoteImage function for getting
information about the digest, which is the same function used for
downloading base images. This way we can also take advantage of the
--insecure and --skip-tls-verify flags if users pass those in when
trying to get digests for the cache as well.
This commit is contained in:
Priya Wadhwa 2018-10-26 11:38:32 -07:00
parent 1639d1d71c
commit 9908eeb30a
1 changed files with 1 additions and 1 deletions

View File

@ -142,7 +142,7 @@ func cachedImage(opts *config.KanikoOptions, image string) (v1.Image, error) {
if d, ok := ref.(name.Digest); ok {
cacheKey = d.DigestStr()
} else {
img, err := remote.Image(ref)
img, err := remoteImage(image, opts)
if err != nil {
return nil, err
}