Skip to content

Clean up go build cache if it exceeds a threshold

Sami Hiltunen requested to merge smh-clean-build-cache into master

Our build process never cleans up the go build cache and neither does go. Users are expected to run go clean --cache occassionally to clean up old files. This has so far been generally fine, given each build didn't bloat the cache too much. With the introduction of packed binaries in 861730ac, the build cache grows at a much higher rate due to the embedded binaries. This has resulted the CI also running out of space. This commit adds a configurable threshold for cleaning up Go's build cache and sets the default at 5 GB. If the build cache is larger than 5GB at the beginning of the build, the build cache is automatically cleaned.

Closes #4392 (closed)

Merge request reports