Is it possible to invalidate or clear a pipeline cache with the Gitlab CI
after a pipeline completes?
My .gitlab-ci.yml
file has the following global cache definition
cache:
key: "%CI_PIPELINE_ID%"
paths:
- './msvc/Project1`/bin/Debug'
- './msvc/Project2`/bin/Debug'
- './msvc/Project3`/bin/Debug'
The cache-key
value specifies that each pipeline should maintain it's own cache, which is working fine, but the cache file continues to exist after the pipeline completes. With hundreds of pipelines being run, the size starts to add up and manually deleting the cache folder on our machine isn't a great solution.
I tried adding a cleanup job at the end of the pipeline
cleanup:
stage: cleanup
script:
- rm -rf './msvc/Project1/bin'
- rm -rf './msvc/Project2/bin'
- rm -rf './msvc/Project3/bin'
when: always
Which deletes the local files, but won't delete them from the cache.
Am I missing something here?
Currently running Gitlab-EE 10.3.3