gitlab - Gitlab pipeline “清理项目目录和基于文件的变量”失败

我有一个 Gitlab pipeline 在尝试 docker build 时失败(使用 https://docs.gitlab.com/ee/ci/docker/using_kaniko.html

我还没有做一个成功的 docker build 但是这个特殊的错误在我之后开始了:

  1. 将 kaniko 图像从 image: gcr.io/kaniko-project/executor:debug 更改为 gcr.io/kaniko-project/executor:51734fc3a33e04f113487853d118608ba6ff2b81
  2. 添加了推送到不安全注册表的设置:--insecure --skip-tls-verify --skip-tls-verify-pull --insecure-pull

在此更改之后,pipeline 的一部分如下所示:

before_script:
    - 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY'
  
  
  build_job:
    tags:
      - xxxx
    only:
      - develop
    stage: build
    script:
      - dotnet build --configuration Release --no-restore
  
  
  publish_job:
    tags:
      - xxxx
    only:
      - develop
    stage: publish
    artifacts:
        name: "$CI_COMMIT_SHA"
        paths:
          - ./$PUBLISH_DIR
    script:
      - dotnet publish ./src --configuration Release --output $(pwd)/$PUBLISH_DIR
    
docker_build_dev:
    tags:
      - xxxx
    image:
      name: gcr.io/kaniko-project/executor:51734fc3a33e04f113487853d118608ba6ff2b81
      entrypoint: [""]
    only:
      - develop
    stage: docker
    before_script:
      - echo "Docker build"
    script:
      - echo "${CI_PROJECT_DIR}"
      - cp ./src/Dockerfile /builds/xxx/xxx/xxx/Dockerfile
      - 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}"
        --insecure
        --skip-tls-verify
        --skip-tls-verify-pull
        --insecure-pull
        --dockerfile "${CI_PROJECT_DIR}/Dockerfile"
        --destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"

pipeline 的部分输出如下:

[32;1mSkipping Git submodules setup[0;m
section_end:1652535765:get_sources
[0Ksection_start:1652535765:download_artifacts
[0K[0K[36;1mDownloading artifacts[0;m[0;m
[32;1mDownloading artifacts for publish_job (33475)...[0;m
Downloading artifacts from coordinator... ok      [0;m  id[0;m=33475 responseStatus[0;m=200 OK token[xxxxxxxxxxx

section_end:1652535769:download_artifacts
[0Ksection_start:1652535769:step_script
[0K[0K[36;1mExecuting "step_script" stage of the job script[0;m[0;m
section_end:1652535769:step_script
[0Ksection_start:1652535769:cleanup_file_variables
[0K[0K[36;1mCleaning up project directory and file based variables[0;m[0;m

section_end:1652539354:cleanup_file_variables
[0K[31;1mERROR: Job failed: execution took longer than 1h0m0s seconds
[0;m

我错过了什么?

回答1

我在启用 Project Registries 的 GitLab 项目设置中遗漏了一些东西:

  1. https://translate.google.com/translate?hl=en&sl=en&tl=zh&u=https://domain/group/subgroup/project/edit
  2. 可见性、项目功能、权限 << 容器注册表(切换到启用)

相似文章

随机推荐

最新文章