GitLab CI Kaniko 和 EKS 超时

GitLab CI Timeout with Kaniko and EKS

我正在尝试按照 GitLab 示例代码使用概述的 kaniko here。我唯一改变的是我使用 v1.7.0-debug 标签而不是简单的 debug.

build:
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:v1.7.0-debug
    entrypoint: [""]
  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
    - >-
      /kaniko/executor
      --context "${CI_PROJECT_DIR}"
      --dockerfile "${CI_PROJECT_DIR}/Dockerfile"
      --destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"

我的构建作业在以下行停止:

Running with gitlab-runner 14.4.0 (4b9e985a)
  on gitlab-runner-gitlab-runner-84d476ff5c-mkt4s HMty8QBu
Preparing the "kubernetes" executor
00:00
Using Kubernetes namespace: gitlab-runner
Using Kubernetes executor with image gcr.io/kaniko-project/executor:v1.7.0-debug ...
Using attach strategy to execute scripts...
Preparing environment
00:03
Waiting for pod gitlab-runner/runner-hmty8qbu-project-31186441-concurrent-0bbt8x to be running, status is Pending
Running on runner-hmty8qbu-project-31186441-concurrent-0bbt8x via gitlab-runner-gitlab-runner-84d476ff5c-mkt4s...
Getting source from Git repository
00:01
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/...
Created fresh repository.
Checking out 4d05d22b as ci...
Skipping Git submodules setup
Executing "step_script" stage of the job script

它只是停在 Executing "step_script" 并且永远不会继续前进。我已全面研究并通读了尽可能多的文档,但无法解决此问题。

设置

这最终成为 Kubernetes 运行器本身如何在运行器配置中配置的问题 toml。我们为运行器使用的默认容器映像需要修改 PATH 环境变量,因此我们使用 environment 配置设置来执行此操作,如 here 所述。似乎这个 PATH 变量没有包含 kaniko 调试映像中定义的 busybox shell。从那以后,我们已经将 PATH 更改移到 Docker 图像中,它应该放在第一位,并且一切正常。