when i use drone in conjunction with drone-gc it doesn’t prune images at all. For whatever reason all images and containers remain on my host gobbling up a lot of drive space (e.g. 180GB in 2 days). Am I missing something in the way drone-gc works? From my understanding as soon as a pipeline finishes or gets cancelled , drone-gc should be able to remove these containers (+volumes and images).
For whatever reason my drone-gc just shows this instead:
2019-08-20T08:12:05Z |DEBU| volume not expired name=4ab1a692e9123e3447c4f7f145dce45bab850613eca73608e4fb120873905f62
2019-08-20T08:12:05Z |DEBU| volume not expired name=b3dc9f1b66c679c8fe16506484af4611d5047e2cea4790b037b3e0a2817136eb
2019-08-20T08:12:05Z |DEBU| volume not expired name=czdtv2ygwd2gbxd8xwb67svdcf1da02x
2019-08-20T08:12:05Z |DEBU| volume not expired name=de320d0d234c541f49f27f75dc38cbd712fa790a3cb9c23e8b3b005707731210
Thanks in advance!
From my understanding as soon as a pipeline finishes or gets cancelled , drone-gc should be able to remove these containers
First it is important to note that the agent tries to remove any volumes it creates when a pipeline finishes. If a volume is orphaned and cannot be deleted, for whatever reason, drone-gc will try to remove it eventually to prevent build up.
drone-gc does not know when a build is finished and therefore does not know if the volume is still needed. Instead each volume has a label called
io.drone.expires that specifies a timestamp for when it is safe to remove the volume. This timestamp is based on the start date + the maximum execution time + a buffer.
volume not expired message in the logs indicates the volume was not removed because the current timestamp is less than the timestamp in the
Finally, drone-gc only tries to cleanup volumes created by the Drone agent with the
io.drone.expires. It will ignore all other volumes not created by the agent.
I recommend looking at the source to further debug: https://github.com/drone/drone-gc/blob/master/gc/volume.go
i think i found the issue. we have a repository that takes quite a while to build. therefore we set the Timeout to 72hrs. apparently that means that drone-gc will mark them as expired only after 72hrs, even if the build finishes after say 5hrs. Last build has actually cleared the images when it finished. I will keep an eye on it.
Thanks for your fast reply.