buildgitlabgitlab-cikaniko

Kaniko do not use cache options


I am trying to use the --cache-repo option of the kaniko executor but I see that it does not use the cache that I saved in ECR/AWS and the gitlab log returns this;

Checking for cached layer [MASKED]/dev-cache:627d56ef7c151b98c02c0de3d3d0d9a5bc8d538b1b1d58632ef977f4501b48f4...
INFO[0521] No cached layer found for cmd COPY --from=build /../../../../..............

I have rebuilt the image with the same tag and the code has not changed and it is still taking the same time...

The version of kaniko I am using is the following gcr.io/kaniko-project/executor:v1.9.1

These are the flags I use in kaniko:

  /kaniko/executor --cache=true \
    --cache-repo "${URL_ECR}/dev-cache" \
    --cache-copy-layers \
    --single-snapshot \
    --context "${CI_PROJECT_DIR}" ${BUILD_IMAGE_EXTRA_ARGS} \
    --dockerfile "${CI_PROJECT_DIR}/Dockerfile" \
    --destination "${IMAGE_NAME}:${IMAGE_TAG}" \
    --destination "${IMAGE_NAME}:latest" \
    --skip-unused-stages \
    --snapshotMode=redo \
    --use-new-run

Do you have any ideas?


Solution

  • Successfully resolved issue by removing the flags: --cache-copy-layers and --single-snapshot, and adding the flag: --cleanup