Hi,
I am trying to pull a package from Google’s Artifact Registry following this documentation.
After the successful login helm pull fails with Error: failed to authorize: failed to fetch anonymous token: unexpected status: 403 Forbidden but sometimes it succeeds. I wasn’t able to figure out how and why. Service account, which key I am using, has all required permissions.
Here is the full log (successful):
cat key.json | helm registry --debug login -u _json_key_base64 --password-stdin https://europe-west3-docker.pkg.dev/engineering-368717/helm-registry && helm pull --debug oci://europe-west3-docker.pkg.dev/engineering-368717/helm-registry/staging/email-service --version 0.1.0
Login Succeeded
DEBU[0000] resolving host=europe-west3-docker.pkg.dev
DEBU[0000] do request host=europe-west3-docker.pkg.dev request.header.accept="application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, */*" request.header.user-agent=Helm/3.10.3 request.method=HEAD url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/manifests/0.1.0"
DEBU[0000] fetch response received host=europe-west3-docker.pkg.dev response.header.alt-svc="h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" response.header.content-length=102 response.header.content-type=application/json response.header.date="Fri, 20 Jan 2023 15:26:39 GMT" response.header.docker-distribution-api-version=registry/2.0 response.header.www-authenticate="Bearer realm=\"https://europe-west3-docker.pkg.dev/v2/token\",service=\"europe-west3-docker.pkg.dev\",scope=\"repository:engineering-368717/helm-registry/staging/email-service:pull\"" response.header.x-content-type-options=nosniff response.header.x-frame-options=SAMEORIGIN response.header.x-xss-protection=0 response.status="401 Unauthorized" url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/manifests/0.1.0"
DEBU[0000] Unauthorized header="Bearer realm=\"https://europe-west3-docker.pkg.dev/v2/token\",service=\"europe-west3-docker.pkg.dev\",scope=\"repository:engineering-368717/helm-registry/staging/email-service:pull\"" host=europe-west3-docker.pkg.dev
DEBU[0000] do request host=europe-west3-docker.pkg.dev request.header.accept="application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, */*" request.header.user-agent=Helm/3.10.3 request.method=HEAD url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/manifests/0.1.0"
DEBU[0000] fetch response received host=europe-west3-docker.pkg.dev response.header.alt-svc="h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" response.header.content-length=353 response.header.content-type=application/vnd.oci.image.manifest.v1+json response.header.date="Fri, 20 Jan 2023 15:26:39 GMT" response.header.docker-content-digest="sha256:28b201f65198b6f5ecc401c6c58ccd5767bb89c619b288aa9b606ade4500d4dc" response.header.docker-distribution-api-version=registry/2.0 response.status="200 OK" url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/manifests/0.1.0"
DEBU[0000] resolved desc.digest="sha256:28b201f65198b6f5ecc401c6c58ccd5767bb89c619b288aa9b606ade4500d4dc" host=europe-west3-docker.pkg.dev
DEBU[0000] do request digest="sha256:28b201f65198b6f5ecc401c6c58ccd5767bb89c619b288aa9b606ade4500d4dc" request.header.accept="application/vnd.oci.image.manifest.v1+json, */*" request.header.user-agent=Helm/3.10.3 request.method=GET url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/manifests/sha256:28b201f65198b6f5ecc401c6c58ccd5767bb89c619b288aa9b606ade4500d4dc"
DEBU[0000] fetch response received digest="sha256:28b201f65198b6f5ecc401c6c58ccd5767bb89c619b288aa9b606ade4500d4dc" response.header.alt-svc="h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" response.header.content-length=353 response.header.content-type=application/vnd.oci.image.manifest.v1+json response.header.date="Fri, 20 Jan 2023 15:26:39 GMT" response.header.docker-content-digest="sha256:28b201f65198b6f5ecc401c6c58ccd5767bb89c619b288aa9b606ade4500d4dc" response.header.docker-distribution-api-version=registry/2.0 response.header.x-content-type-options=nosniff response.header.x-frame-options=SAMEORIGIN response.header.x-xss-protection=0 response.status="200 OK" url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/manifests/sha256:28b201f65198b6f5ecc401c6c58ccd5767bb89c619b288aa9b606ade4500d4dc"
DEBU[0000] do request digest="sha256:7404113340c566b9200059ba22aa8f8074d299794b2178c7efc309fa8c34222c" request.header.accept="application/vnd.cncf.helm.chart.content.v1.tar+gzip, */*" request.header.user-agent=Helm/3.10.3 request.method=GET url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/blobs/sha256:7404113340c566b9200059ba22aa8f8074d299794b2178c7efc309fa8c34222c"
DEBU[0000] do request digest="sha256:2083e87173b09ed1d66ac5d35b08dfe581f7c2f938cc2f4f045eb8b98b410abe" request.header.accept="application/vnd.cncf.helm.config.v1+json, */*" request.header.user-agent=Helm/3.10.3 request.method=GET url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/blobs/sha256:2083e87173b09ed1d66ac5d35b08dfe581f7c2f938cc2f4f045eb8b98b410abe"
DEBU[0000] fetch response received digest="sha256:2083e87173b09ed1d66ac5d35b08dfe581f7c2f938cc2f4f045eb8b98b410abe" response.header.accept-ranges=bytes response.header.alt-svc="h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" response.header.content-length=137 response.header.content-type=application/octet-stream response.header.date="Fri, 20 Jan 2023 15:26:40 GMT" response.header.docker-distribution-api-version=registry/2.0 response.header.x-content-type-options=nosniff response.header.x-frame-options=SAMEORIGIN response.header.x-xss-protection=0 response.status="200 OK" url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/blobs/sha256:2083e87173b09ed1d66ac5d35b08dfe581f7c2f938cc2f4f045eb8b98b410abe"
DEBU[0000] encountered unknown type application/vnd.cncf.helm.config.v1+json; children may not be fetched
DEBU[0000] fetch response received digest="sha256:7404113340c566b9200059ba22aa8f8074d299794b2178c7efc309fa8c34222c" response.header.accept-ranges=bytes response.header.alt-svc="h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" response.header.cache-control="private, max-age=0" response.header.content-length=3952 response.header.content-type=application/octet-stream response.header.date="Fri, 20 Jan 2023 15:26:40 GMT" response.header.expires="Fri, 20 Jan 2023 15:26:40 GMT" response.header.server=UploadServer response.header.x-goog-hash="crc32c=DYoQ4w==" response.header.x-guploader-uploadid=ADPycdu3XwUND8_8d27U5Rr9aO6e0RnD3yT6M_lbQXZvdK5Yf2bwEbsUVl9h7PZ6r26MBH0qBYV9uakQT2EqfRVBOYQuej5StMOT response.status="200 OK" url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/blobs/sha256:7404113340c566b9200059ba22aa8f8074d299794b2178c7efc309fa8c34222c"
DEBU[0000] encountered unknown type application/vnd.cncf.helm.chart.content.v1.tar+gzip; children may not be fetched
Pulled: europe-west3-docker.pkg.dev/engineering-368717/helm-registry/staging/email-service:0.1.0
Digest: sha256:28b201f65198b6f5ecc401c6c58ccd5767bb89c619b288aa9b606ade4500d4dc
And unsuccessful:
cat key.json | helm registry --debug login -u _json_key_base64 --password-stdin https://europe-west3-docker.pkg.dev/engineering-368717/helm-registry && helm pull --debug oci://europe-west3-docker.pkg.dev/engineering-368717/helm-registry/staging/email-service --version 0.1.0
Login Succeeded
DEBU[0000] resolving host=europe-west3-docker.pkg.dev
DEBU[0000] do request host=europe-west3-docker.pkg.dev request.header.accept="application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, */*" request.header.user-agent=Helm/3.10.3 request.method=HEAD url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/manifests/0.1.0"
DEBU[0000] fetch response received host=europe-west3-docker.pkg.dev response.header.alt-svc="h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" response.header.content-length=102 response.header.content-type=application/json response.header.date="Fri, 20 Jan 2023 15:26:43 GMT" response.header.docker-distribution-api-version=registry/2.0 response.header.www-authenticate="Bearer realm=\"https://europe-west3-docker.pkg.dev/v2/token\",service=\"europe-west3-docker.pkg.dev\",scope=\"repository:engineering-368717/helm-registry/staging/email-service:pull\"" response.header.x-content-type-options=nosniff response.header.x-frame-options=SAMEORIGIN response.header.x-xss-protection=0 response.status="401 Unauthorized" url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/manifests/0.1.0"
DEBU[0000] Unauthorized header="Bearer realm=\"https://europe-west3-docker.pkg.dev/v2/token\",service=\"europe-west3-docker.pkg.dev\",scope=\"repository:engineering-368717/helm-registry/staging/email-service:pull\"" host=europe-west3-docker.pkg.dev
DEBU[0000] do request host=europe-west3-docker.pkg.dev request.header.accept="application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, */*" request.header.user-agent=Helm/3.10.3 request.method=HEAD url="https://europe-west3-docker.pkg.dev/v2/engineering-368717/helm-registry/staging/email-service/manifests/0.1.0"
INFO[0000] trying next host error="failed to authorize: failed to fetch anonymous token: unexpected status: 403 Forbidden" host=europe-west3-docker.pkg.dev
Error: failed to authorize: failed to fetch anonymous token: unexpected status: 403 Forbidden
helm.go:84: [debug] failed to authorize: failed to fetch anonymous token: unexpected status: 403 Forbidden
Output of helm version:
version.BuildInfo{Version:"v3.10.3", GitCommit:"835b7334cfe2e5e27870ab3ed4135f136eecc704", GitTreeState:"clean", GoVersion:"go1.18.9"}
Output of kubectl version:
Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.8", GitCommit:"fdc77503e954d1ee641c0e350481f7528e8d068b", GitTreeState:"clean", BuildDate:"2022-11-09T13:38:19Z", GoVersion:"go1.18.8", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.4
Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.7-gke.900", GitCommit:"e35c4457f66187eff006dda6d2c0fe12144ef2ec", GitTreeState:"clean", BuildDate:"2022-10-26T09:25:34Z", GoVersion:"go1.18.7b7", Compiler:"gc", Platform:"linux/amd64"}