File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -190,13 +190,16 @@ def main():
190190 else :
191191 print (f"No container tags to prune for build { build_id } ." )
192192 actions_completed .append (action ) # Append action to completed list
193- # Update policy-cleanup for completed actions
194- policy_cleanup = build .setdefault ("policy-cleanup" , {})
195- for action in actions_completed :
196- if action == "images" :
197- policy_cleanup ["images-kept" ] = images_to_keep
198- else :
199- policy_cleanup [action ] = True
193+ # Only add policy-cleanup for the build in builds.json if any
194+ # of the cleanup actions were completed.
195+ if actions_completed :
196+ policy_cleanup = build .setdefault ("policy-cleanup" , {})
197+ # Update policy-cleanup for completed actions
198+ for action in actions_completed :
199+ if action == "images" :
200+ policy_cleanup ["images-kept" ] = images_to_keep
201+ else :
202+ policy_cleanup [action ] = True
200203
201204 if pruned_build_ids :
202205 if "tombstone-builds" not in builds_json_data :
You can’t perform that action at this time.
0 commit comments