Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd-coreos-prune: Add build pruning after other actions #3988

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

gursewak1997
Copy link
Member

We want to complete all other actions before fully pruning a build and deleting the S3 directory. This guarantees the meta.json file remains accessible if needed.

@@ -172,8 +172,7 @@ def main():
prune_images(s3_client, current_build, images_to_keep, args.dry_run, bucket, prefix)
# Fully prune releases that are very old including deleting the directory in s3 for that build.
case "build":
prune_build(s3_client, bucket, prefix, build_id, args.dry_run)
pruned_build_ids.append(build_id)
builds_to_prune.append(build_id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
builds_to_prune.append(build_id)
# Since pruning a build prunes s3 for all architectures
# we'll prune later so that we do it only once and we
# make sure we've completed any architecture specific
# operations, (i.e. pruning aarch64 AMIs).
builds_to_prune.append(build_id)

@@ -112,7 +112,7 @@ def main():
builds_json_data = json.load(f)
# Original list of builds
builds = builds_json_data["builds"]
pruned_build_ids = []
builds_to_prune = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should make this a set so we can't add an entry more than once, which is what I think the below code will be doing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True that, updating.

We wanna make every other action is run before we prune a build fully
and delete the s3 dir. It makes sure the meta.json is still available
if needed.
Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gursewak1997 gursewak1997 enabled auto-merge (rebase) December 11, 2024 23:34
@gursewak1997 gursewak1997 merged commit 17c1cc8 into coreos:main Dec 11, 2024
5 checks passed
@gursewak1997 gursewak1997 deleted the fix-builds-pruning-step branch December 12, 2024 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants