go-containerregistry icon indicating copy to clipboard operation
go-containerregistry copied to clipboard

crane: should support multiple credentials to the same registry

Open acornett21 opened this issue 3 years ago • 3 comments

Describe the bug

When trying to pull an image from a registry ie quay.io with an auth file that contains multiple entries for the same registry, crane gives an UNATHORIZED error.

To Reproduce

  1. Have access to a registry with different accounts for different namespaces/images
  2. Create an auth file with multiple entries for the same registry
{
  "auths": {
    "quay.io/telcoci/simple-demo-operator-bundle": {
      "auth": "XXXXXX"
    },
    "quay.io/telcoci": {
      "auth": "YYYYYY"
    },
    "quay.io": {
      "auth": "ZZZZZZ"
    }
  }
}
  1. Run crane pull quay.io/telcoci/simple-demo-operator-catalog:0.0.3 (as an example)
  2. See an error of Error: GET https://quay.io/v2/telcoci/simple-demo-operator-catalog/manifests/0.0.3: UNAUTHORIZED: access to the requested resource is not authorized; map[]

Expected behavior

I'd expect crane to be able to use the proper auth value like podman, skopeo, buildah, etc.

Additional context

This also does not work when using the crane api's. We are using crane as a library for a go based project found here, so should be implemented in the cli as well as the api.

This also might relate to:

  • #723

but I think crane cli cmds use the files in the authn pkg

  • Output of crane version: 0.8.0
  • Registry used (e.g., GCR, ECR, Quay): quay but I assume this exists for all registries.

acornett21 avatar Mar 30 '22 16:03 acornett21