Feature Request: When clearing cache (pipeline) allow option to actually delete it

Release notes

When clearing cache on a Pipeline, the cache just gets incremented by a number, and causes the runner to fill up over time requiring an admin to intervene and clear out the cache.
(Please see here: https://docs.gitlab.com/ee/ci/caching/).
On a docker runner, simply doing a "docker volume rm 'volume names'" would fix this.

Currently, this script is recommended:
https://gitlab.com/gitlab-org/gitlab-runner/blob/main/packaging/root/usr/share/gitlab-runner/clear-docker-cache

But it deletes ALL cache, requires an admin, and is just kinda messy.

It would be nice when clicking "Clear runner caches", it could prompt you to "Delete old cache"?

Problem to solve

When clearing cache on a pipeline it does not delete it causing the cache volume to fill up and then requires an admin to intervene. It would be nice if the user could physically delete the old cache.

Proposal

When clicking on Clear runner caches, the option to delete the old cache would be nice. (For a docker runner, this should be pretty easy with docker volume rm 'volume names'. I understand that if someone is using S3, or some other bucket for cache, it would be different, but each could be added over time.


Another option would be to show current caches still sitting around when you go to Settings->CI/CD->Runners and here have a list of current attached volumes with a delete button next to each. (Of course, have disk space usage next to each cache would be really handy)

Intended users

Developer / User

Feature Usage Metrics

Not having to buy beer for admin, or if you are an admin, not having to deal with bad beer. Also, not filling up runners seems nice to fellow developers.

Does this feature require an audit event?

It shouldn't, however, protected branches may need special attention.

Labels

ep::pipeline section::ci

Edited by 🤖 GitLab Bot 🤖