[llvm] [ci] Fix the base branch we use to determine changes (PR #79503)

Louis Dionne via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 13:33:01 PST 2024


https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/79503

>From edf87f4c9cb5c8657c5fc4062378f2a6786419f4 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 25 Jan 2024 16:18:09 -0500
Subject: [PATCH 1/2] [ci] Fix the base branch we use to determine changes

We should diff against the base branch, not always against `main`.
This allows the BuildKite pre-commit CI to work properly when we
target other branches, such as `release/18.x`.
---
 .ci/generate-buildkite-pipeline-premerge | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index 34d914696018d61..3d5e86f25feb18c 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -22,17 +22,18 @@ set -o pipefail
 
 # Environment variables script works with:
 
-# Fetch origin/main to have an up to date merge base for main...HEAD diff.
-git fetch origin main:main
+# Set by buildkite
+: ${BUILDKITE_PULL_REQUEST_BASE_BRANCH:=}
+: ${BUILDKITE_COMMIT:=}
+: ${BUILDKITE_BRANCH:=}
+# Fetch origin to have an up to date merge base for the diff.
+git fetch origin
 # List of files affected by this commit
-: ${MODIFIED_FILES:=$(git diff --name-only main...HEAD)}
+: ${MODIFIED_FILES:=$(git diff --name-only ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD)}
 # Filter rules for generic windows tests
 : ${WINDOWS_AGENTS:='{"queue": "windows"}'}
 # Filter rules for generic linux tests
 : ${LINUX_AGENTS:='{"queue": "linux"}'}
-# Set by buildkite
-: ${BUILDKITE_COMMIT:=}
-: ${BUILDKITE_BRANCH:=}
 
 reviewID="$(git log --format=%B -n 1 | sed -nE 's/^Review-ID:[[:space:]]*(.+)$/\1/p')"
 if [[ "${reviewID}" != "" ]]; then

>From 803b0bc18ece6cccb391ce147a56995b5df72eac Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 25 Jan 2024 16:32:50 -0500
Subject: [PATCH 2/2] TEMPORARY: print what we do in the pipeline generation

---
 .ci/generate-buildkite-pipeline-premerge | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index 3d5e86f25feb18c..e42467ebd81b306 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -17,7 +17,7 @@
 # prefix with "#".
 
 
-set -eu
+set -eux
 set -o pipefail
 
 # Environment variables script works with:



More information about the llvm-commits mailing list