kaniko unautorized

Summary

kaniko work when I used a kubernetes gitlab-runner but not working with a runner in VM.

Steps to reproduce

Create helm gitlab-runner with url add token value. Create a runner with gitlagb-runner register ( runner -> docker default ubuntu:18.04 ) Create a project and include the following code:

Build App:
  stage: build_dev
  tags:
    - test34
  image:
    name: gcr.io/kaniko-project/executor:$KANIKO_VERSION
    entrypoint: [""]
  script:
    - mkdir -p /root/.docker
    - echo "{\"auths\":{\"$DOCKER_REGISTRY\":{\"username\":\"$TESTHTTPD_ROBOT_USERNAME\",\"password\":\"$TESTHTTPD_ROBOT_PASSWORD\"}}}" > /root/.docker/config.json
    - cat /root/.docker/config.json 
    - /kaniko/executor --skip-tls-verify-pull  --verbosity debug --skip-tls-verify --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Docker/Dockerfile --destination $DOCKER_REGISTRY/$DOCKER_REGISTRY_PROJET/$DOCKER_REGISTRY_IMAGE:$TAG_IMAGE_DEV --destination $DOCKER_REGISTRY/$DOCKER_REGISTRY_PROJET/$DOCKER_REGISTRY_IMAGE:dev-latest
  only:
    refs:
      - dev
    changes:
      - Docker/**/*
      - Sources/**/*

test with tag correspond to gitlab-runner register by VM. -> doesn't work test with tag correspond to kubernetes register -> work.

Example Project

What is the current bug behavior?

not working with gitlab-runner register.

What is the expected correct behavior?

working

Relevant logs and/or screenshots

EBU[0000] Copying file /builds/app-ci/swe/test-httpd/Docker/Dockerfile to /kaniko/Dockerfile 
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 "https://my_registry.co/test-httpd/test-httpd:dev-b0ad05ff": POST https://my_registry.co/v2/test-httpd/test-httpd/blobs/uploads/: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:test-httpd/test-httpd Type:repository] map[Action:push Class: Name:test-httpd/test-httpd Type:repository]]
  • DOCKER_REGISTRY_PROJET => test-httpd
  • DOCKER_REGISTRY_IMAGE => test-httpd

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by Hordur Freyr Yngvason