Skip to content

Commit

Permalink
cmd-coreos-prune: fix skipping of images action
Browse files Browse the repository at this point in the history
This detection wasn't working properly and causing the `images`
action to get run even for builds where the images had already
been pruned.
  • Loading branch information
dustymabe authored and jlebon committed Feb 10, 2025
1 parent 7d6fa37 commit fd1bfd1
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/cmd-coreos-prune
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,15 @@ def main():

# Skip if the action has been handled previously for the build
if action in previous_cleanup:
# If we are in here then there has been some previous cleanup of
# this type run for this build. For all types except `images` we
# can just continue.
if action != "images":
print(f"\t\tBuild {build_id} has already had {action} pruning completed")
continue
print(f"\t\tBuild {build_id} has already had {action} pruning completed")
continue
# We have to handle the "images" action separately because the key in the previous
# cleanup is "images-kept" and not "images"
if action == 'images' and 'images-kept' in previous_cleanup:
# OK `images` has been pruned before, but we need to check
# that all the images were pruned that match the current policy.
# i.e. there may be additional images we need prune
elif set(images_to_keep) == set(previous_cleanup.get("images-kept", [])):
if set(images_to_keep) == set(previous_cleanup.get("images-kept", [])):
print(f"\t\tBuild {build_id} has already had {action} pruning completed")
continue

Expand Down

0 comments on commit fd1bfd1

Please sign in to comment.