-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[CI] Use the exit code from the premerge advisor #172393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[CI] Use the exit code from the premerge advisor #172393
Conversation
Created using spr 1.3.7
|
@llvm/pr-subscribers-infrastructure Author: Aiden Grossman (boomanaiden154) ChangesThis patch makes it so that we use an exit code determined by the Full diff: https://github.com/llvm/llvm-project/pull/172393.diff 2 Files Affected:
diff --git a/.ci/premerge_advisor_explain.py b/.ci/premerge_advisor_explain.py
index 6296599aa4f49..00df1b94c4578 100644
--- a/.ci/premerge_advisor_explain.py
+++ b/.ci/premerge_advisor_explain.py
@@ -7,6 +7,7 @@
import platform
import sys
import json
+import os
# TODO(boomanaiden154): Remove the optional call once we can require Python
# 3.10.
@@ -158,3 +159,5 @@ def main(
args.pr_number,
args.return_code,
)
+
+ sys.exit(args.return_code)
diff --git a/.ci/utils.sh b/.ci/utils.sh
index 713a07ba5d898..098b1e696a87b 100644
--- a/.ci/utils.sh
+++ b/.ci/utils.sh
@@ -37,10 +37,10 @@ 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)
fi
if [[ "$retcode" != "0" ]]; then
@@ -54,6 +54,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
|
| $(git rev-parse HEAD~1) $retcode "${GITHUB_TOKEN}" \ | ||
| $GITHUB_PR_NUMBER "${BUILD_DIR}"/test-results.*.xml \ | ||
| "${MONOREPO_ROOT}"/ninja*.log | ||
| "${MONOREPO_ROOT}"/ninja*.log) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this in a subshell now?
I thought maybe it was something to do with not setting the return code but afaict, the return code is propogated from the subshell.
| fi | ||
|
|
||
| if [[ -n "$GITHUB_ACTIONS" ]]; then | ||
| exit $advisor_retcode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see where this comes from. I expect it is in one of the stacked PRs though, I just can't find which one.
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.