mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-17 23:59:11 +02:00
Support for private registries in the cache warmer
Closes #503 Signed-off-by: Stijn De Haes <stijndehaes@gmail.com>
This commit is contained in:
Vendored
+4
-1
@@ -20,10 +20,12 @@ import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/config"
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/creds"
|
||||
"github.com/google/go-containerregistry/pkg/name"
|
||||
v1 "github.com/google/go-containerregistry/pkg/v1"
|
||||
"github.com/google/go-containerregistry/pkg/v1/remote"
|
||||
@@ -115,7 +117,8 @@ func (w *Warmer) Warm(image string, opts *config.WarmerOptions) (v1.Hash, error)
|
||||
return v1.Hash{}, errors.Wrapf(err, "Failed to verify image name: %s", image)
|
||||
}
|
||||
|
||||
img, err := w.Remote(cacheRef)
|
||||
rOpts := []remote.Option{remote.WithTransport(http.DefaultTransport.(*http.Transport)), remote.WithAuthFromKeychain(creds.GetKeychain())}
|
||||
img, err := w.Remote(cacheRef, rOpts...)
|
||||
if err != nil || img == nil {
|
||||
return v1.Hash{}, errors.Wrapf(err, "Failed to retrieve image: %s", image)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user