Open stavalfi opened 4 years ago
after investigation, a workaround is:
specifying --cache-repo
that is different compared to --destination=stavalfi/kaniko-bug-reproduce:1.0.0
solved it:
'--cache-repo=stavalfi/kaniko-bug-cache',
I would expect from kaniko to have an error about it (if thats the desired behavior)
experiencing the same issue, seems random
experiencing the same issue. Added --cache=true
will not able to push
INFO[0262] Pushing layer asia.gcr.io/xxxx/xxxx:3d99e9f12e13a0741b105f976920493168d520fc1b8d2a2566d4600b2410155f to cache now
WARN[0263] error uploading layer to cache: failed to push to destination asia.gcr.io/xxxx/xxxx:yyyyyyy: GET https://asia.gcr.io/v2/token?scope=repository%xxxx%2Fxxxx%3Apush%2Cpull&service=asia.gcr.io: 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
Removing --cache=true
is able to push
Seems using --cache=true --cache-repo=xxx
is not work with GOOGLE_APPLICATION_CREDENTIALS
In GitLab CI,
variables:
GOOGLE_APPLICATION_CREDENTIALS: $CI_PROJECT_DIR/google_auth.json
IMAGE_URL: asia.gcr.io/xxx/$CI_PROJECT_NAME
publish:
tags:
- microk8s
image: gcr.io/kaniko-project/executor:debug-v1.3.0
stage: publish
script:
- cp $gcr_key $CI_PROJECT_DIR/google_auth.json
- >
/kaniko/executor
--cache=true
--cache-repo=$IMAGE_URL
--log-timestamp=true
--snapshotMode=redo
--context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/Dockerfile
--destination $IMAGE_URL:$TAG
--build-arg=DEPLOY_VERSION=${TAG}
I am experiencing something similar. When I specify both --no-push
and also --cache-repo
in a single Kaniko build step, the Kaniko executor is unable to push to the cache registry. In the same cloubuild.yaml
configuration file, subsequent build steps are able to push the their respective registries.
My use case is building a base image which shares a common cache repository with downstream stages to reduce build time.
Actual behavior
when using
--cache=true
, kaniko fail to push cache layer.Expected behavior there shouldn't be any failures
To Reproduce Steps to reproduce the behavior:
I created a repo to reproduce the bug: https://github.com/stavalfi/kaniko-bug-reproduce the secret was created using the instruction of kaniko "getting started": https://github.com/GoogleContainerTools/kaniko/blob/master/docs/tutorial.md
Additional Information
Dockerfile
pod.yaml:
gcr.io/kaniko-project/executor debug-v1.2.0 c91ffaa6289b (im not sure how to give more info)
--cache
flag