Skip to content

Commit 3a76784

Browse files
gursewak1997jlebon
authored andcommitted
cmd-cloud-prune: Add tombstone-builds into builds count
Add the deleted builds into the total number of builds from the builds.json when asserting that the size of builds array is the same in the original and our modified builds.json
1 parent 845be98 commit 3a76784

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cmd-cloud-prune

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,10 @@ def handle_upload_builds_json(s3_client, bucket, prefix, dry_run, acl):
277277

278278
with open(BUILDFILES['sourcedata'], 'r') as file:
279279
builds_json_source_data = json.load(file)
280-
# Make sure the size of the builds array is the same in the original and our modified builds.json
281-
assert len(builds_json_source_data.get('builds')) == len(updated_builds_json.get('builds'))
280+
# Make sure the size of the builds+tombstone-builds array is the same in the original and our modified builds.json
281+
source_builds_count = len(builds_json_source_data.get('builds', [])) + len(builds_json_source_data.get('tombstone-builds', []))
282+
updated_builds_count = len(updated_builds_json.get('builds', [])) + len(updated_builds_json.get('tombstone-builds', []))
283+
assert source_builds_count == updated_builds_count
282284

283285
# Before uploading builds.json, copy the updated tmp/builds-source.json as builds.json.bak as a backup
284286
s3_copy(s3_client, BUILDFILES['sourcedata'], bucket, f'{prefix}/builds.json.bak', CACHE_MAX_AGE_METADATA, acl, extra_args={}, dry_run=dry_run)

0 commit comments

Comments
 (0)