[llvm-branch-commits] [llvm] [🍒][ci] Fix the base branch we use to determine changes (#79503) (PR #79506)
Louis Dionne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jan 25 13:42:37 PST 2024
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/79506
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`.
(cherry picked from commit 3b762891826192ded07286852d326f9c9060f52e)
>From fce5c171b463d766cb25208634553a39b94498a6 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 25 Jan 2024 16:38:53 -0500
Subject: [PATCH] =?UTF-8?q?[=F0=9F=8D=92][ci]=20Fix=20the=20base=20branch?=
=?UTF-8?q?=20we=20use=20to=20determine=20changes=20(#79503)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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`.
(cherry picked from commit 3b762891826192ded07286852d326f9c9060f52e)
---
.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 f32eb7213b9402..009cb6933e8fa9 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -22,19 +22,20 @@ 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"}'}
# Service agents, for interacting with Phabricator.
: ${SERVICE_AGENTS:='{"queue": "service"}'}
-# 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
More information about the llvm-branch-commits
mailing list