Skip to content

Kaniko build not working with gitlab-runner version >=15.8.0

Summary

Since we have updated our gitlab-runners to version 15.8.0 the Kaniko build in our pipelins stopped working. The issue also happens on 15.8.1. When I downgrade the gitlab-runners to 15.7.3 the Kaniko build step is working as expected. The runners are executed in a Kubernetes-Cluster. The error message I get is:

....
INFO[0013] Adding exposed port: 8080/tcp                
INFO[0013] ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] 
INFO[0015] Skipping push to container registry due to --no-push flag 

Saving cache for successful job
00:00

Uploading artifacts for successful job
00:00

Cleaning up project directory and file based variables
00:00
ERROR: Job failed (system failure): Internal error occurred: error executing command in container: failed to exec in container: failed to start exec "f092797ea9f5b8701aa039642878274faf31830cf99223b17b4609e1da5e2386": OCI runtime exec failed: exec failed: unable to start container process: chdir to cwd ("/workspace") set in config.json failed: no such file or directory: unknown

It looks like that the build process is already finished. On a successful run, after the INFO[0015] Skipping push to container registry due to --no-push flag line comes an info line like Creating cache 0-default-6-protected....

Steps to reproduce

  • Running Kaniko build successfully on gitlab-runner 15.7.3
  • Updated gitlab-runner to 15.8.[0|1]
  • See the error
.gitlab-ci.yml
kaniko-build:
  stage: container-build
  image:
    name: gcr.io/kaniko-project/executor:v1.9.1-debug
    entrypoint:
    - ''
  before_script:
  - mkdir -p /kaniko/.docker
  - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}"
    "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
  extends:
  - ".container-build"
  cache:
  - key:
      files:
      - yarn.lock
    paths:
    - ".yarn-cache/"
    - node_modules/
  script:
  - /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${DOCKERFILE_PATH}"
    --destination "${CI_REGISTRY_IMAGE}":"${CI_COMMIT_SHORT_SHA}" --build-arg VCS_REF="${CI_COMMIT_HASH}"
    --build-arg BUILD_DATE="${CI_COMMIT_TIMESTAMP}" --build-arg APPDIR="${CI_PROJECT_DIR}"
    --tarPath "${CI_PROJECT_NAME}"_"${CI_COMMIT_SHORT_SHA}".tar --no-push
  artifacts:
    paths:
    - "${CI_PROJECT_NAME}_${CI_COMMIT_SHORT_SHA}.tar"
    expire_in: 1 hour

Used GitLab Runner version

Running with gitlab-runner 15.8.1 (f86890c6)
  on gitlab-runner-86597988d8-4xjkj U-TiS56A, system ID: r_GASpYrtovUzE

Preparing the "kubernetes" executor
Using Kubernetes namespace: gitlab
Using Kubernetes executor with image gcr.io/kaniko-project/executor:v1.9.1-debug ...