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

Fix implicit GCR auth #1856

Merged
merged 2 commits into from
Dec 29, 2021
Merged

Conversation

imjasonh
Copy link
Collaborator

@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)

@imjasonh imjasonh merged commit 633f555 into GoogleContainerTools:master Dec 29, 2021
@imjasonh imjasonh mentioned this pull request Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants