CI: Set error status for job with OOM

This commit is contained in:
Max K 2024-07-12 20:32:01 +02:00
parent 90142b73ad
commit 1495ef3218
2 changed files with 22 additions and 2 deletions

View File

@ -36,6 +36,7 @@ disable = '''
bare-except,
no-else-return,
global-statement,
f-string-without-interpolation,
'''
[tool.pylint.SIMILARITIES]

View File

@ -1125,6 +1125,7 @@ def main() -> int:
### POST action: start
elif args.post:
has_oom_error = False
if Shell.check(
"sudo dmesg -T | grep -q -e 'Out of memory: Killed process' -e 'oom_reaper: reaped process' -e 'oom-kill:constraint=CONSTRAINT_NONE'"
):
@ -1132,6 +1133,7 @@ def main() -> int:
CIBuddy(dry_run=not pr_info.is_release).post_error(
"Out Of Memory", job_name=_get_ext_check_name(args.job_name)
)
has_oom_error = True
job_report = JobReport.load() if JobReport.exist() else None
if job_report:
@ -1234,6 +1236,23 @@ def main() -> int:
indata["build"],
ch_helper,
)
else:
if CI.is_test_job(args.job_name):
if has_oom_error:
description = "ERROR: Out Of Memory"
else:
description = "ERROR: Unknown job status"
gh = GitHub(get_best_robot_token(), per_page=100)
commit = get_commit(gh, pr_info.sha)
post_commit_status(
commit,
ERROR,
"",
description,
job_report.check_name or _get_ext_check_name(args.job_name),
pr_info,
dump_to_file=True,
)
else:
# no job report
print(f"No job report for {[args.job_name]} - do nothing")