From 67389171abd7a8f038ac02cf458fef952258fbac Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Tue, 16 Dec 2025 15:49:39 -0800 Subject: [PATCH] [CI] Use the exit code from the premerge advisor This patch makes it so that we use an exit code determined by the premerge advisor rather than whatever exit code was returned by the failing command. This is intended for making it so that we can mark the CI as green if all of the failures are explained as either flaky or already failing at HEAD. For now we just propagate whatever the last command returned. Reviewers: cmtice Pull Request: https://github.com/llvm/llvm-project/pull/172393 --- .ci/premerge_advisor_explain.py | 2 ++ .ci/utils.sh | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.ci/premerge_advisor_explain.py b/.ci/premerge_advisor_explain.py index 6296599aa4f4..a88bfd223d9a 100644 --- a/.ci/premerge_advisor_explain.py +++ b/.ci/premerge_advisor_explain.py @@ -158,3 +158,5 @@ if __name__ == "__main__": args.pr_number, args.return_code, ) + + sys.exit(args.return_code) diff --git a/.ci/utils.sh b/.ci/utils.sh index 713a07ba5d89..923c64a4e169 100644 --- a/.ci/utils.sh +++ b/.ci/utils.sh @@ -37,10 +37,11 @@ function at-exit { python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \ $retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \ >> $GITHUB_STEP_SUMMARY - python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \ + (python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \ $(git rev-parse HEAD~1) $retcode "${GITHUB_TOKEN}" \ $GITHUB_PR_NUMBER "${BUILD_DIR}"/test-results.*.xml \ - "${MONOREPO_ROOT}"/ninja*.log + "${MONOREPO_ROOT}"/ninja*.log) + advisor_retcode=$? fi if [[ "$retcode" != "0" ]]; then @@ -54,6 +55,10 @@ function at-exit { "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log fi fi + + if [[ -n "$GITHUB_ACTIONS" ]]; then + exit $advisor_retcode + fi } trap at-exit EXIT