-
Notifications
You must be signed in to change notification settings - Fork 183
cmd-cloud-prune: Refactor to iterate by build, arch, then action #3928
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
Conversation
317b390 to
2541712
Compare
dustymabe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trivial LGTM
A few questions/suggestions on the code as I was going through.
src/cmd-cloud-prune
Outdated
| policy_cleanup = build.setdefault("policy-cleanup", {}) | ||
| action_duration = convert_duration_to_days(policy[stream][action]) | ||
| ref_date = today_date - relativedelta(days=int(action_duration)) | ||
| images_to_keep = policy.get(stream, {}).get("images-keep", []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
images_to_keep should be the same for all runs of these loops, right? if so we can move the variable definition to the outside of these loops.
src/cmd-cloud-prune
Outdated
| # Iterate through builds from oldest to newest | ||
| for build in reversed(builds): | ||
| build_id = build["id"] | ||
| (build_date, _) = parse_fcos_version_to_timestamp_and_stream(build_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are the outer parentheses required here?
| (build_date, _) = parse_fcos_version_to_timestamp_and_stream(build_id) | |
| build_date, _ = parse_fcos_version_to_timestamp_and_stream(build_id) |
dustymabe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh actually. if you look at the commit title it is wrong:
overrides: Pin kdump-utils-1.0.48-1.fc42 for ppc64le
Reorganized the loop structure to iterate over builds first, followed by arch and then actions, optimizing the number of meta.json downloads and reducing redundancy.
2541712 to
ff8a909
Compare
dustymabe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
/test rhcos |
Reorganized the loop structure to iterate over builds first, followed by arch and then actions, optimizing the number of meta.json downloads and reducing redundancy.