File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -99,14 +99,23 @@ def last_in_progress_elapsed_time_check():
99
99
100
100
def _cleanup_tickets_with_terminal_states ():
101
101
files = _list_tickets ()
102
+ build_ids = []
102
103
for file in files :
103
104
_ , build_id , _ = _build_info_from_file (file )
104
- client = boto3 .client ("codebuild" )
105
- response = client .batch_get_builds (ids = [build_id ])
106
- build_status = response ["builds" ][0 ]["buildStatus" ]
105
+ build_ids .append (build_id )
107
106
108
- if build_status != "IN_PROGRESS" :
109
- print ("Build %s in terminal state: %s, deleting lock" % (build_id , build_status ))
107
+ client = boto3 .client ("codebuild" )
108
+ response = client .batch_get_builds (ids = build_ids )
109
+
110
+ for file , build_details in zip (files , response ["builds" ]):
111
+ _ , _build_id_from_file , _ = _build_info_from_file (file )
112
+ build_status = build_details ["buildStatus" ]
113
+
114
+ if build_status != "IN_PROGRESS" and _build_id_from_file == build_details ["id" ]:
115
+ print (
116
+ "Build %s in terminal state: %s, deleting lock"
117
+ % (_build_id_from_file , build_status )
118
+ )
110
119
file .delete ()
111
120
112
121
You can’t perform that action at this time.
0 commit comments