Skip to content

Commit

Permalink
🐛 Use allowed-failures and skips equally
Browse files Browse the repository at this point in the history
Before this patch, `allowed-failures` did not contribute to the
overall computed outcome due to a bug in the checking logic. This
change refactors the data strucutures used to simplify the check and
reduce its complexity in general.

Fixes #23
  • Loading branch information
webknjaz committed Aug 25, 2023
1 parent 223e4bb commit cf9edfc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/normalize_needed_jobs_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,17 @@ def main(argv):
)
return 1

allowed_outcome_map = {}
for job_name in jobs.keys():
allowed_outcome_map[job_name] = {'success'}
if job_name in jobs_allowed_to_be_skipped:
allowed_outcome_map[job_name].add('skipped')
if job_name in jobs_allowed_to_fail:
allowed_outcome_map[job_name].add('failure')

job_matrix_succeeded = all(
job['result'] == 'success' for name, job in jobs.items()
if name not in (jobs_allowed_to_fail | jobs_allowed_to_be_skipped)
) and all(
job['result'] in {'skipped', 'success'} for name, job in jobs.items()
if name in jobs_allowed_to_be_skipped
job['result'] in allowed_outcome_map[name]
for name, job in jobs.items()
)
set_final_result_outputs(job_matrix_succeeded)

Expand Down

0 comments on commit cf9edfc

Please sign in to comment.