首页 > 解决方案 > 带有 Kaniko 和 EKS 的 GitLab CI 超时

问题描述

我正在尝试按照此处概述的使用 kaniko 的 GitLab 示例代码进行操作。我唯一改变的是我使用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",永远不会继续前进。我已经全面研究并阅读了尽可能多的文档,但无法解决此问题。

设置

标签: gitlabgitlab-cikaniko

解决方案


这最终成为了 Kubernetes 运行器本身在运行器配置中的配置方式的问题toml。我们用于跑步者的默认容器映像需要修改PATH环境变量,因此我们使用environment配置设置来执行此操作,如此所述。似乎这个PATH变量不包括在 kaniko 调试映像中定义的 busybox shell。从那以后,我们将这个PATH更改移到了我们的 Docker 映像中,它本来应该放在首位,并且一切都按预期工作。


推荐阅读