Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Fix implicit GCR auth#1856

Merged
imjasonh merged 2 commits intoGoogleContainerTools:masterfrom
imjasonh:fix-gcr-auth
Dec 29, 2021
Merged

Fix implicit GCR auth#1856
imjasonh merged 2 commits intoGoogleContainerTools:masterfrom
imjasonh:fix-gcr-auth

Conversation

@imjasonh
Copy link
Copy Markdown
Contributor

@imjasonh imjasonh commented Dec 23, 2021

Description

This partially reverts cf4822c, which intended to support GCR auth in scenarios where the credential helper wasn't available (e.g., executor-slim), to preserve backward compatibility since the credential helper used to be present.

However, that change seems to have broken auth to GCR from GCB, and presumably other scenarios where there's implicit GCP auth from the environment.

This change uses ggcr's google.NewEnvAuthenticator to find implicit GCR auth when none other is available, and when the registry being operated against is GCR or AR.

With this change I'm able to run this successfully, which failed before:

cat > Dockerfile < EOF
FROM ubuntu
EOF
docker build -t gcr.io/imjasonh/kaniko -f deploy/Dockerfile .
docker push gcr.io/imjasonh/kaniko
gcloud config set builds/kaniko_image gcr.io/imjasonh/kaniko
gcloud builds submit . -t gcr.io/imjasonh/kaniko-built

(This also works if you build and run the slim image, which does not contain cred helpers 🎉 )

This produced this kaniko-built image: gcr.io/imjasonh/kaniko-built@sha256:6d8fa0158919992232c6f6eaf882ec88df790709384cc84a1043a087f5e34c8a

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes unit tests
  • Adds integration tests if needed.

See the contribution guide for more details.

Reviewer Notes

  • The code flow looks good.
  • Unit tests and or integration tests added.

Release Notes

Describe any changes here so maintainer can include it in the release notes, or delete this block.

Fix issue with implicit auth against GCR/AR repositories (broken in v1.7.0)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants