Skip to content

Commit

Permalink
[πŸ’][ci] Fix the base branch we use to determine changes (#79503) (#79506
Browse files Browse the repository at this point in the history
)

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 3b76289)
  • Loading branch information
ldionne authored Jan 25, 2024
1 parent 6abd792 commit 3173faa
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .ci/generate-buildkite-pipeline-premerge
Original file line number Diff line number Diff line change
Expand Up @@ -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 origin/${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
Expand Down

0 comments on commit 3173faa

Please sign in to comment.