[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
This commit is contained in:
Aiden Grossman
2025-12-16 15:49:39 -08:00
committed by GitHub
parent 60587b21d4
commit 67389171ab
2 changed files with 9 additions and 2 deletions

View File

@@ -158,3 +158,5 @@ if __name__ == "__main__":
args.pr_number,
args.return_code,
)
sys.exit(args.return_code)

View File

@@ -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