Skip to content

Commit 23ced76

Browse files
committed
fix base branch detection in fuzzer jobs
1 parent 7012970 commit 23ced76

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

docker/test/fuzzer/run-fuzzer.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,21 @@ function clone
5050
git checkout "$SHA_TO_TEST"
5151
echo "Checked out nominal SHA $SHA_TO_TEST for PR $PR_TO_TEST"
5252
fi
53-
git diff --name-only master HEAD | tee ci-changed-files.txt
53+
# Use BASE_BRANCH from environment variable if available, otherwise fall back to master
54+
if [ -n "$BASE_BRANCH" ]; then
55+
echo "Using base branch from environment: $BASE_BRANCH"
56+
MERGE_BASE=$(git merge-base HEAD "origin/$BASE_BRANCH" 2>/dev/null || echo "")
57+
if [ -z "$MERGE_BASE" ]; then
58+
echo "ERROR: No merge base found with base branch: $BASE_BRANCH"
59+
echo "Available remote branches:"
60+
git branch -r
61+
exit 1
62+
fi
63+
git diff --name-only "$MERGE_BASE" HEAD | tee ci-changed-files.txt
64+
else
65+
echo "No BASE_BRANCH environment variable, using master"
66+
git diff --name-only master HEAD | tee ci-changed-files.txt
67+
fi
5468
else
5569
if [ -v SHA_TO_TEST ]; then
5670
git fetch --depth 2 origin "$SHA_TO_TEST"

tests/ci/ci_fuzzer_check.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def get_run_command(
3434
f"-e SHA_TO_TEST={pr_info.sha}",
3535
f"-e BINARY_URL_TO_DOWNLOAD='{build_url}'",
3636
f"-e FUZZER_TO_RUN='{fuzzer_name}'",
37+
f"-e BASE_BRANCH='{pr_info.base_ref}'",
3738
]
3839

3940
env_str = " ".join(envs)

0 commit comments

Comments
 (0)