[llvm] [CI] Only upload test results if buildkite-agent is present (PR #119954)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 23:57:09 PST 2024


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

This patch modifies the monolithic shell scrips to only run if the buildkite-agent application is present. This allows for running the scripts to completion outside of buildkite (eg inside of a GHA pipeline).

>From 085a3686247a8e4d42d0e22384d57a1650f9f233 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sat, 14 Dec 2024 07:53:12 +0000
Subject: [PATCH] [CI] Only upload test results if buildkite-agent is present

This patch modifies the monolithic shell scrips to only run if the
buildkite-agent application is present. This allows for running the
scripts to completion outside of buildkite (eg inside of a GHA
pipeline).
---
 .ci/monolithic-linux.sh   | 7 +++++--
 .ci/monolithic-windows.sh | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index a4aeea7a16addc..4bfebd5f752795 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -34,8 +34,11 @@ function at-exit {
 
   # If building fails there will be no results files.
   shopt -s nullglob
-  python3 "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":linux: Linux x64 Test Results" \
-    "linux-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
+  if command -v buildkite-agent 2>&1 >/dev/null
+  then
+    python3 "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":linux: Linux x64 Test Results" \
+      "linux-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
+  fi
 }
 trap at-exit EXIT
 
diff --git a/.ci/monolithic-windows.sh b/.ci/monolithic-windows.sh
index 4ead122212f4f0..25cdd2f419f479 100755
--- a/.ci/monolithic-windows.sh
+++ b/.ci/monolithic-windows.sh
@@ -33,8 +33,11 @@ function at-exit {
 
   # If building fails there will be no results files.
   shopt -s nullglob
-  python "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":windows: Windows x64 Test Results" \
-    "windows-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
+  if command -v buildkite-agent 2>&1 >/dev/null
+  then
+    python "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":windows: Windows x64 Test Results" \
+      "windows-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
+  fi
 }
 trap at-exit EXIT
 



More information about the llvm-commits mailing list