From ca3fc36ac9c17963d80ab1e631f6d820e20fb238 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Tue, 28 Nov 2023 22:36:40 -0800 Subject: [PATCH] builder-next: fix timing filter for default policy Signed-off-by: Tonis Tiigi (cherry picked from commit 49d088d9ce62fa86aa08dc05dedc3a3b0746675b) Signed-off-by: Sebastiaan van Stijn --- builder/builder-next/worker/gc.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builder/builder-next/worker/gc.go b/builder/builder-next/worker/gc.go index 13e65f0e6f..372b74efe7 100644 --- a/builder/builder-next/worker/gc.go +++ b/builder/builder-next/worker/gc.go @@ -2,6 +2,7 @@ package worker import ( "math" + "time" "github.com/moby/buildkit/client" ) @@ -30,12 +31,12 @@ func DefaultGCPolicy(p string, defaultKeepBytes int64) []client.PruneInfo { // if build cache uses more than 512MB delete the most easily reproducible data after it has not been used for 2 days { Filter: []string{"type==source.local,type==exec.cachemount,type==source.git.checkout"}, - KeepDuration: 48 * 3600, // 48h + KeepDuration: 48 * time.Hour, KeepBytes: tempCacheKeepBytes, }, // remove any data not used for 60 days { - KeepDuration: 60 * 24 * 3600, // 60d + KeepDuration: 60 * 24 * time.Hour, KeepBytes: keep, }, // keep the unshared build cache under cap