Drone

Drone-gc doesn't seem to clean up build cache

We are using the new experimental docker build-kit on our CI (see https://docs.docker.com/develop/develop-images/build_enhancements/). “docker system df” shows around 8 GB in “build cache”. We configured drone-gc with GC_CACHE=5gb. It looks like the build cache is not properly cleaned up.

The drone-gc utility is responsible for cleaning up objects that are created by the runner (networks, volumes, images, etc). The drone-gc utility is not currently responsible for cleaning up objects that are created by going out-of-bounds and interacting directly with the host machine docker socket in your pipeline. At this time the build cache is out of scope for drone-gc.

However, with that being said, we would certainly accept a pull request that defines a new GC_BUILD_CACHE variable and uses this variable to control the size of the build cache (it looks like there is an API call that can help with this). For compatibility with existing systems, this would need to be disabled by default.