Kaniko: credentials not working anymore from gitlab CI

Created on 13 Jan 2019  路  6Comments  路  Source: GoogleContainerTools/kaniko

Since 996bec885fe3274d92a53935079f03448c44103a (afaict) pushing to gitlab registry from gitlab CI does not work anymore

I have a gitlab-ci.yaml similar to this:

build image:
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: ["/busybox/sh", "-c"]
  before_script:
    - mkdir -p /root/.docker
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /root/.docker/config.json
    - build="/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/config/docker/site/Dockerfile --cache --cache-repo $CI_REGISTRY_IMAGE/cache"
  script:
    - $build --destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}

It works again if I use gcr.io/kaniko-project/executor@sha256:b3ed3368390c0ab105487c4a35e8fff747519dde7f3f9ae6dc2c58d87aea9016 but not with gcr.io/kaniko-project/executor@sha256:d8097ad1de40491c89e387f390935ee0a861dec30dbbe1c752293cad736c0615 (I found those here : https://console.cloud.google.com/gcr/images/kaniko-project/GLOBAL/executor?gcrImageListsize=30)

which is why I suspect 996bec885fe3274d92a53935079f03448c44103a of breaking this

is something need to be changed on how to use kaniko from gitlab ( I followed their doc so it would need to be updated) or is this a bug?

Most helpful comment

is /root/.docker/config.json not the wrong path and should be /kaniko/.docker/config.json?

All 6 comments

is /root/.docker/config.json not the wrong path and should be /kaniko/.docker/config.json?

indeed it works with the latest gcr.io/kaniko-project/executor:debug when putting the auth info in /kaniko/.docker/config.json

not sure why it worked with /root/.docker/config.json before

I'll let this open in case this is not the expected behavior. otherwise anyone from the project can close this

thx @sbrech

We are using the config.json file but still had failures deploying to Artifactory. We now are using the image gcr.io/kaniko-project/executor:debug-170e0a2d9419ffc1317d65a80565585aa0332aa0.

Thanks @sbrech and @mathroc that worked for me

GitLab docs and Kaniko docs (example pod spec for pushing to ECR, but should be applicable with any registry) both say to use /kaniko/.docker. Recommend closure

Was this page helpful?
0 / 5 - 0 ratings