Skip to content

Commit

Permalink
Manual changes for go-containerregistry update.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlorenc committed Aug 22, 2018
1 parent a42a509 commit fa17f5d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
23 changes: 12 additions & 11 deletions pkg/minikube/machine/cache_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@ package machine

import (
"io/ioutil"
"net/http"
"os"
"os/exec"
"path"
"path/filepath"
"runtime"
"strings"

"github.com/google/go-containerregistry/v1/tarball"
"github.com/google/go-containerregistry/pkg/v1/tarball"

"github.com/google/go-containerregistry/authn"
"github.com/google/go-containerregistry/pkg/authn"

"github.com/google/go-containerregistry/name"
"github.com/google/go-containerregistry/v1/remote"
"github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/remote"

"golang.org/x/sync/errgroup"

Expand Down Expand Up @@ -296,14 +295,16 @@ func CacheImage(image, dst string) error {
return errors.Wrap(err, "creating docker image name")
}

auth, err := authn.DefaultKeychain.Resolve(tag.Registry)
if err != nil {
return errors.Wrap(err, "setting up registry auth")
}
img, err := remote.Image(tag, auth, http.DefaultTransport)
img, err := remote.Image(tag, remote.WithAuthFromKeychain(authn.DefaultKeychain))
if err != nil {
return errors.Wrap(err, "fetching remote image")
}

return tarball.Write(dstPath, tag, img, nil)
glog.Infoln("OPENING: ", dstPath)
f, err := os.Create(dstPath)
if err != nil {
return err
}
defer f.Close()
return tarball.Write(tag, img, nil, f)
}
2 changes: 1 addition & 1 deletion test/integration/persistence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"path/filepath"
"testing"
"time"

"strings"
"github.com/docker/machine/libmachine/state"
"k8s.io/minikube/test/integration/util"
)
Expand Down

0 comments on commit fa17f5d

Please sign in to comment.