Search code examples
gitlabgitlab-cikaniko

Gitlab pipeline failing on "Cleaning up project directory and file based variables"


I have a Gitlab pipeline that is failing when it attempts docker build (using Kaniko)

I am yet to do a successful docker build BUT this particular error has started after I :

  1. Changed the kaniko image from image: gcr.io/kaniko-project/executor:debug to gcr.io/kaniko-project/executor:51734fc3a33e04f113487853d118608ba6ff2b81
  2. Added settings for pushing to insecure registries : --insecure --skip-tls-verify --skip-tls-verify-pull --insecure-pull

After this change part of the pipeline looks like this :

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}"

Part of the output from the pipeline is as below:

[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

What am I missing?


Solution

  • I was missing something in my GitLab project settings which is enabling Project Registries :

    1. https://domain/group/subgroup/project/edit
    2. Visibility,project features,permissions << Container Registry (Toggle to enable)