Skip to content

Conversation

@boomanaiden154
Copy link
Contributor

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.

Created using spr 1.3.7
@llvmbot llvmbot added the infrastructure Bugs about LLVM infrastructure label Dec 16, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 16, 2025

@llvm/pr-subscribers-infrastructure

Author: Aiden Grossman (boomanaiden154)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/172393.diff

2 Files Affected:

  • (modified) .ci/premerge_advisor_explain.py (+3)
  • (modified) .ci/utils.sh (+6-2)
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
 

Created using spr 1.3.7
$(git rev-parse HEAD~1) $retcode "${GITHUB_TOKEN}" \
$GITHUB_PR_NUMBER "${BUILD_DIR}"/test-results.*.xml \
"${MONOREPO_ROOT}"/ninja*.log
"${MONOREPO_ROOT}"/ninja*.log)
Copy link
Collaborator

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
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Bugs about LLVM infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants