Add a "clear_caches" hook to the custom gitlab runner to avoid leaving dangling files
Problem to solve
If you use custom gitlab runner with cache based on S3 or a shared mount, Gitlab makes a zipfile of all cached files and directories and uses it on further builds.
If you then clear the runner caches with the button at the CI/CD -> Pipelines page, the zipfile identifier increases it's number by 1 (eg if it was cache-1.zip, now it will be cache-2.zip). This works to start fresh since the cacche-2.zip won't exist the first time so a new one will be created, but the old one is never deleted.
It takes some time for this to be an issue with S3 since it's very cheap, but on shared disks or clusters using min.io, it's easier to end up with disks full and having to clear entire caché directories. It's also quite hard to delete these files on an S3 bucket, it can take quite some time to do so.
Intended users
User experience goal
It's unclear that "Clear Runner Caches" doesn't clear the runner cache, instead it just leaves it orphan. It should actually be cleared when pressed.
Proposal
Add an interceptable option (like prepare/run/cleanup) called cache_clear
or clear_caches
and allowing us to create an executable file to actually clear the old zipfile.