Files
seaweedfs/seaweed-block/.github/scripts/chunkstore-scope.sh
T
pingqiuandClaude Opus 5.5 166bba1252 ci: run the integration tests for provider-only changes; harden the ledger check
The scope gate selected the real-filer suites only for chunk-store and
storage changes, but its second suite tests the durable provider: a PR
that changed only core/frontend/durable/ skipped it. The ledger anchor
check is the hardened script: a git failure or a ledger with no rows is
an error (exit 2), not a pass, and a path matches whole components only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 18:45:26 -08:00

34 lines
1.2 KiB
Bash

#!/usr/bin/env bash
# chunkstore-scope.sh BASE HEAD: decides whether a pull request runs the
# real-filer integration tests. It prints one line:
# "run N FIRST" at least one of the N changed files is under
# core/frontend/chunkstore/, core/storage/ or
# core/frontend/durable/ (FIRST is one)
# "skip N" none of the N changed files is
# and exits 0. Any error (git fails, the list cannot be read) exits nonzero,
# and the caller then runs the tests: an error never selects skip.
#
# The NUL-delimited list is written to a file first and read to its end, so
# no pipe can stop early and leave a writer's error looking like an answer.
set -euo pipefail
[ "$#" -eq 2 ] || { echo "usage: chunkstore-scope.sh BASE HEAD" >&2; exit 2; }
list=$(mktemp)
trap 'rm -f "$list"' EXIT
if ! git diff --name-only --no-renames -z "$1" "$2" >"$list"; then
echo "chunkstore-scope: git diff $1 $2 failed" >&2
exit 2
fi
n=0
hit=""
while IFS= read -r -d '' f; do
n=$((n + 1))
case $f in
core/frontend/chunkstore/* | core/storage/* | core/frontend/durable/*) [ -n "$hit" ] || hit=$f ;;
esac
done <"$list"
if [ -n "$hit" ]; then
echo "run $n $hit"
else
echo "skip $n"
fi