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

Push Permission Error on latest #1786

Closed
zkanda opened this issue Oct 20, 2021 · 29 comments
Closed

Push Permission Error on latest #1786

zkanda opened this issue Oct 20, 2021 · 29 comments

Comments

@zkanda
Copy link

zkanda commented Oct 20, 2021

Actual behavior
Permission error on pushing to google container registry.

Step #0: error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: checking push permission for "eu.gcr.io/<project-id>/services/svc:master-xxxx": creating push check transport for eu.gcr.io failed: GET https://eu.gcr.io/v2/token?scope=repository%3A<project-id>%2Fservices%2Fsvc%3Apush%2Cpull&service=eu.gcr.io: UNAUTHORIZED: Not Authorized.
Finished Step #0
ERROR
ERROR: build step 0 "gcr.io/kaniko-project/executor:latest" failed: step exited with non-zero status: 1

Expected behavior
It should successfully push, I reverted to 1.6.0 and it works great.

To Reproduce
Make a google build with this yaml:

steps:
- name: 'gcr.io/kaniko-project/executor:latest'
  args:
  - --destination=eu.gcr.io/$PROJECT_ID/services/svc:$BRANCH_NAME-$SHORT_SHA
  - --dockerfile=svc/Dockerfile
  - --cache=true
  - --cache-ttl=168h
  - --cache-repo=eu.gcr.io/$PROJECT_ID/cache
  - --snapshotMode=redo
  - --use-new-run

Additional Information

  • Dockerfile
    Any dockerfile will reproduce the error.
  • Kaniko Image (fully qualified with digest)
    gcr.io/kaniko-project/executor:latest
    digest: 8504bde9a9a8c9c4e9a4fe659703d265697a36ff13607b7669a4caa4407baa52

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
Please check if the build works in docker but not in kaniko
Please check if this error is seen when you use --cache flag
Please check if your dockerfile is a multistage dockerfile
@yuiseki
Copy link

yuiseki commented Oct 20, 2021

Same here.

My environment is:

  • Google Cloud Build
  • Google Container Registry

I've confirmed when I specify gcr.io/kaniko-project/executor:v1.6.0, it works expectedly.

@jonbuffington
Copy link

My environment is also:

  • Google Cloud Build
  • Google Container Registry

If I specify gcr.io/kaniko-project/executor:edge, it also works.

@rodosskiand
Copy link

+1

  • Google Container Registry
  • debug image

@chandanpasunoori
Copy link

Same here.

My environment is:

Google Cloud Build
Google Container Registry

I've confirmed when I specify gcr.io/kaniko-project/executor:v1.6.0, it works expectedly.

@nielsbox
Copy link

Same

My environment also is:

  • Google Cloud Build
  • Google Container Registry

@nirav-chotai
Copy link

gcr.io/kaniko-project/executor:debug

This is also broken, cannot push the images to GCR

@fr0stylo
Copy link

Same here:
Environnment:

  • GKE
  • GCR
  • debug 1.7 image

Downgrading to 1.6 works

@slahs3r
Copy link

slahs3r commented Oct 20, 2021

Same here.

My environment is:

  • Google Cloud Build
  • Google Container Registry

This workaround works for me:

gcloud config set builds/kaniko_image gcr.io/kaniko-project/executor:v1.6.0

@chrisapplegate
Copy link

Getting the same issue. My environment is:

  • Google Cloud Build
  • Google Container Registry

Changing the container reference in my cloudbuild.yaml to gcr.io/kaniko-project/executor:v1.6.0 solves the issue, I have found

@Retsuki
Copy link

Retsuki commented Oct 20, 2021

Could this fix be the cause?
#1471

@plechi
Copy link

plechi commented Oct 20, 2021

In reference to the comment by @jonbuffington
#1786 (comment)

My environment is also:

  • Google Cloud Build
  • Google Container Registry

If I specify gcr.io/kaniko-project/executor:edge, it also works.

Keep in mind that this image is from May 7, 2020. I think it's better to use the v1.6.0 tag until this is fixed.

@stijntratsaertit
Copy link

Same issue, Google Cloud Build & Google Container Registry here

@jonbuffington
Copy link

In reference to the comment by @jonbuffington #1786 (comment)

My environment is also:

  • Google Cloud Build
  • Google Container Registry

If I specify gcr.io/kaniko-project/executor:edge, it also works.

Keep in mind that this image is from May 7, 2020. I think it's better to use the v1.6.0 tag until this is fixed.

RIght. Thanks!

@amichal
Copy link

amichal commented Oct 20, 2021

Diffing v1.6.0 and v1.7.0 i noticed a change to conditionally loading a credential helper here v1.6.0...v1.7.0#diff-4c345264209a6b2e4584f42b5fc96ef58595aef6dbb3b342e02aa723ce7323d7R68-R81 I know zero about this codebase so probably not reading the code right but seems maybe related

aomarks added a commit to lit/lit.dev that referenced this issue Oct 20, 2021
The latest version of kaniko (https://cloud.google.com/build/docs/kaniko-cache) is failing to build lit.dev with a permissions error. Many other users are seeing the same thing today. Downgrading temporarily works.

See GoogleContainerTools/kaniko#1786
@robertlindner
Copy link

Same:

  • Push to GCR check fails
  • gitlab.com runner (on gke)
  • GOOGLE_APPLICATION_CREDENTIALS pointing to service account key file for gcr auth
  • I have additional credentials for the gitlab registry in /kaniko/.docker/config.json

@dakl
Copy link

dakl commented Oct 22, 2021

Same problem. Pinning 1.6.0 ( - name: "gcr.io/kaniko-project/executor:v1.6.0" in cloudbuild.yaml) works fine.

@jdziek
Copy link

jdziek commented Oct 22, 2021

Same problem here. Exactly when i started learning CI/CD with kaniko so naturally i assumed that the error was on my part. Anyone has any alternative to using gcr.io/kaniko-project/executor:debug with GCP? Im very new to that.

EDIT: For anyone using debug version use for now "gcr.io/kaniko-project/executor:v1.6.0-debug" instead of "gcr.io/kaniko-project/executor:debug". At leat that did the trick for me.
EDIT2: At least partially. There are still some issues with it but definetly better than not passing at all.

@krishnarajan-acumenTec
Copy link

myself also tried unable to push image to gcr

error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: checking push permission for "gcr.io/[MASKED]/[MASKED]:2.0.10": creating push check transport for gcr.io failed: GET https://gcr.io/v2/token?scope=repository%3A[MASKED]%2Flb4b-mi%2F[MASKED]%3Apush%2Cpull&service=gcr.io: UNAUTHORIZED: Not Authorized.

@ferrastas
Copy link
Contributor

I managed to fix it by explicitly calling the docker-credential-gcr helper before the build.

docker-credential-gcr config --token-source=env
docker-credential-gcr configure-docker --registries=[your-registry-path]

Where registry-path is the root path for the GCP Container Registry like gcr.io/$PROJECT_ID

@imjasonh
Copy link
Collaborator

I did some digging in #702 (comment) (which probably should have been in this issue 🤦‍♂️), but it sounds like the docker-credential-gcr config --token-source=env was removed from deploy/Dockerfile between v1.6.0 and v1.7.0, which might be the cause.

@Paraplegix
Copy link

Same error using Gitlab CI with gitlab runner (docker executor)
I tryed including ferratas fix (explicitly calling docker-credential-gcr) but it's still refusing to run.
I saw to variation of the error during testing, they are similar but different (I am not sure what the difference is) :

UNAUTHORIZED: Not Authorized.

and

UNAUTHORIZED: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication

I also tryed regenerating the service acount key (the json file), giving our service account Editor role just in case but it didn't help
We are reverting back to v1.6.0-debug allow us to have build working

@dinvlad
Copy link

dinvlad commented Oct 22, 2021

Yea this is not about permissions, unfortunately - it's just that Kaniko no longer generates the authentication token from env credentials, so it's a 401 error not 403..

@dogomedia-github
Copy link

+1 Same as everyone else

My environment is:

Google Cloud Build
Google Container Registry

Downgrading to 1.6.0 fixes the error, but this is not a viable work around. Updating hundreds of projects to use 1.6.0 is hardly a solution. Why was this change made without proper QA testing to make sure it doesn't break anything?

@joeholley
Copy link

+1, although I'm using Google Artifact Registry as my target from Cloud Build, not Container Registry.

@briandealwis
Copy link
Member

We’ve rolled back the Kaniko images to point to v1.6.0.

@dinvlad
Copy link

dinvlad commented Oct 25, 2021

@briandealwis thanks! Btw are there any regression/integration tests that could prevent this kind of issue from cropping up again? It would be really helpful to test Kaniko in all of the supported environments, if you have time to implement that :-)

hatsuyuki15 added a commit to hatsuyuki15/drone-kaniko that referenced this issue Nov 5, 2021
sinmetal added a commit to sinmetal/cloudrun_helloworld that referenced this issue Jan 25, 2022
shubham149 added a commit to drone/drone-kaniko that referenced this issue Feb 8, 2022
This reverts commit 0a4b18d.

Kaniko 1.7.0 version is unable to push latest tag on gcr:
GoogleContainerTools/kaniko#1786 (comment)
@zkanda
Copy link
Author

zkanda commented Mar 24, 2022

The latest version now works for me for a few days. Closing this.

@gsabbih6
Copy link

gsabbih6 commented Dec 3, 2023

It does not work, was this resolved. ! have same issue, tried every build of kaniko

@inimaz
Copy link

inimaz commented May 22, 2024

Same issue here, we are using the debug tag.

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

No branches or pull requests