From bf1eb4c83960fcd4b39a31f2bed69e210970d522 Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Wed, 20 Aug 2025 19:50:18 +0200 Subject: [PATCH] update protection logic the previous code would end up dropping the protected versions from the shasums, we'll want to keep them there as well. to achieve this we now collect all protected releases and then append them to the keep list once the keep list has been pruned. seems the most reliable way of doing this --- upload-vacuum/main.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/upload-vacuum/main.go b/upload-vacuum/main.go index 3921301..ee8a8dc 100644 --- a/upload-vacuum/main.go +++ b/upload-vacuum/main.go @@ -246,14 +246,12 @@ func main() { return } - for _, tombstone := range config.TombstoneImages { - log.Println("Ignoring (keeping) tombstone image", tombstone) - delete(releases, tombstone) + var toProtect []string + for _, release := range config.TombstoneImages { + toProtect = append(toProtect, release) } - - for _, gold := range config.GoldImages { - log.Println("Ignoring (keeping) golden image", gold) - delete(releases, gold) + for _, release := range config.GoldImages { + toProtect = append(toProtect, release) } // Sort releases by key @@ -265,10 +263,11 @@ func main() { var toDelete []string for len(toKeep) > 4 { - log.Println("Marking for deletion", toKeep[len(toKeep)-1]) + log.Println("Marking for deletion (unless protected)", toKeep[len(toKeep)-1]) toDelete = append(toDelete, toKeep[len(toKeep)-1]) toKeep = toKeep[:len(toKeep)-1] } + toKeep = append(toKeep, toProtect...) // always keep protected versions for _, key := range toDelete { log.Println("Deleting", key)