Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update go-containerregistry to fix entrypoint getRemoteImage (google.Keychain failure) #647

Merged
merged 3 commits into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ required = [

[[constraint]]
name = "github.com/google/go-containerregistry"
# HEAD as of 2019-03-07
revision = "fcd5acbb4e785f428f197ddd66a8931df6923fe6"
# HEAD as of 2019-03-20
revision = "8d4083db9aa0d2fae6588c1acdbe6a1f5db461e3"

[[override]]
name = "github.com/golang/protobuf"
Expand Down
14 changes: 1 addition & 13 deletions pkg/reconciler/v1alpha1/taskrun/entrypoint/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/google/go-containerregistry/pkg/authn/k8schain"
"github.com/google/go-containerregistry/pkg/name"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/google"
"github.com/google/go-containerregistry/pkg/v1/remote"
lru "github.com/hashicorp/golang-lru"
buildv1alpha1 "github.com/knative/build/pkg/apis/build/v1alpha1"
Expand Down Expand Up @@ -187,17 +186,6 @@ func getRemoteImage(image string, kubeclient kubernetes.Interface, build *buildv
return nil, fmt.Errorf("Failed to parse image %s: %v", image, err)
}

// First try to get the image anonymously
// FIXME(vdemeester): once google.Keychain fails smoother, this could be removed
// See https://gist.github.com/vdemeester/c397ffb3fd19b4cc2ba3243dc4db9f83 for the current errors
// with google.Keychain in case `gcloud` command isn't available in the cluster.'
if img, err := remote.Image(ref); err == nil {
// Calling ConfigFile to actually try to connect to the remote registry
if _, err := img.ConfigFile(); err == nil {
return img, nil
}
}

kc, err := k8schain.New(kubeclient, k8schain.Options{
Namespace: build.Namespace,
ServiceAccountName: build.Spec.ServiceAccountName,
Expand All @@ -209,7 +197,7 @@ func getRemoteImage(image string, kubeclient kubernetes.Interface, build *buildv
// this will first try to authenticate using the k8schain,
// then fall back to the google keychain,
// then fall back to anonymous
mkc := authn.NewMultiKeychain(kc, google.Keychain)
mkc := authn.NewMultiKeychain(kc)
img, err := remote.Image(ref, remote.WithAuthFromKeychain(mkc))
if err != nil {
return nil, fmt.Errorf("Failed to get container image info from registry %s: %v", image, err)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading