CI: cache folder is deleted after extracting
With next .yml script
cache: key: "$CI_BUILD_NAME" paths: - .gradle/ debug: script: - ./gradlew assemble
I'm expecting to keep
.gradle/ folder cached between builds.
Instead it is empty, because when job is triggered for 2 commits
- 1st worker is starting, extracting folder, deleting cache folder, running build, saving cache folder.
- 2nd worker is starting, can't extract cache folder, since it is deleted by 1st worker.
It looks like corner case, but at the end, I'm missing cache for half of the builds.
Is it possible to tweak somehow behaviour to delete cache folder only before saving new one and not at the start of the script? So both worker 1 and worker 2 can extract cache folder saved by worker 0?