[llvm] [CI] Use the exit code from the premerge advisor (PR #172393)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 15 16:47:52 PST 2025


https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/172393

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.


>From f49e82faed9a4dcf38ad1e0e62fbdb7c75f7b13b Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Tue, 16 Dec 2025 00:47:42 +0000
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.7
---
 .ci/premerge_advisor_explain.py | 3 +++
 .ci/utils.sh                    | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

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
 



More information about the llvm-commits mailing list