From febcc25d1aff14ee87f6b7c722831c321b8aee09 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Tue, 2 Aug 2022 12:11:41 +0100 Subject: [PATCH] prune: fix filter until option Previously, when specifying the filter option with the until value, no cache would be cleaned, preventing users from clearing by time. This bug arises from passing the until field through into buildkit, where, on filtering, a non-existent field returns false for a match. The fix is simple, as we build up our list of filters to pass to buildkit, we skip over the until key, so create a valid list of filters for buildkit. Signed-off-by: Justin Chadwell --- commands/prune.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/commands/prune.go b/commands/prune.go index 237ce9ed..4040b8b3 100644 --- a/commands/prune.go +++ b/commands/prune.go @@ -176,6 +176,10 @@ func toBuildkitPruneInfo(f filters.Args) (*client.PruneInfo, error) { bkFilter := make([]string, 0, f.Len()) for _, field := range f.Keys() { + if field == filterKey { + continue + } + values := f.Get(field) switch len(values) { case 0: