fix: M8 review findings (restore ownership, barrier tool, World0 claimRef, CI selection, drill verdicts)
P1: restore-world.sh claims its objects path (mkdir) and the database (a held session with a restore try-lock and the exclusive upgrade lock), and removes only what it created, so a losing restore never drops a winner's schema. P2: barrier Ready-pod selection via shared jsonpath helper with fixtures; barrier pod fsGroup; script-generated pods inspected by the policy check; World0 PV claim references protected; ci-paths.sh uses the event's real base and runs on uncertainty; fault-drill asserts RTO and needs positive quarantine evidence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+32
-12
@@ -1,35 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# Decides whether a CI suite must run: exit 0 = run, exit 1 = nothing relevant changed.
|
||||
#
|
||||
# The comparison base comes from the event (review M8 P2), never from HEAD^ alone:
|
||||
# - push: CI_BEFORE (the push's `before` SHA), so every commit of a multi-commit push
|
||||
# counts, not just the last;
|
||||
# - pull_request: CI_PR_BASE (the base SHA), diffed against the checked-out merge;
|
||||
# - workflow_dispatch, schedule, a local run or any other event: always run.
|
||||
# A missing, all-zero or unfetchable base, or any git failure, also runs the suite:
|
||||
# uncertainty never skips validation. tools/ci/ci-paths-check.sh tests this offline.
|
||||
set -euo pipefail
|
||||
|
||||
suite=${1:?suite required}
|
||||
base=${GITHUB_EVENT_BEFORE:-}
|
||||
if [[ -z "$base" || "$base" == 0000000000000000000000000000000000000000 ]]; then
|
||||
base=HEAD^
|
||||
event="${CI_EVENT:-${GITHUB_EVENT_NAME:-}}"
|
||||
case "$event" in
|
||||
push) base="${CI_BEFORE:-${GITHUB_EVENT_BEFORE:-}}" ;;
|
||||
pull_request) base="${CI_PR_BASE:-}" ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
if [[ ! "$base" =~ ^[0-9a-f]{40}$ || "$base" == 0000000000000000000000000000000000000000 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# A single-parent diff is sufficient for push and the merge commit generated for
|
||||
# pull requests. If history is unavailable, fail open and run the gate.
|
||||
if ! files=$(git diff --name-only "$base" HEAD 2>/dev/null); then
|
||||
if ! git cat-file -e "$base^{commit}" 2> /dev/null; then
|
||||
git fetch --no-tags --quiet --depth=1 origin "$base" > /dev/null 2>&1 || exit 0
|
||||
git cat-file -e "$base^{commit}" 2> /dev/null || exit 0
|
||||
fi
|
||||
if ! files=$(git diff --name-only "$base" HEAD 2> /dev/null); then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Every suite runs when the workflow or this selector changes.
|
||||
common='\.gitea/workflows/|tools/ci/ci-paths\.sh'
|
||||
native='CMakeLists\.txt|CMakePresets\.json|cmake/|include/|src/|apps/'
|
||||
postgres_tools='migrations/|tools/prepare-postgres\.sh|tools/migrate-postgres\.sh|tools/backup/|tools/ci/postgres-check\.sh|tools/ci/backup-check\.sh|tools/ci/dr-check\.sh|tools/ci/upgrade-check\.sh'
|
||||
case "$suite" in
|
||||
checks|tsan|ecs)
|
||||
grep -Eq '^(CMakeLists.txt|CMakePresets.txt|CMakePresets.json|cmake/|include/|src/|apps/|tests/|experiments/|tools/ci/linux-check.sh|tools/ci/tsan-profile.mjs|deploy/docker/Dockerfile|\.gitea/workflows/)' <<<"$files"
|
||||
pattern="$common|$native|tests/|experiments/|tools/ci/linux-check\.sh|tools/ci/tsan-profile\.mjs|deploy/docker/Dockerfile"
|
||||
;;
|
||||
postgres|postgres-tools)
|
||||
grep -Eq '^(CMakeLists.txt|CMakePresets.json|cmake/|include/|src/|apps/|tests/|migrations/|tools/prepare-postgres.sh|tools/ci/postgres-check.sh|tools/ci/backup-check.sh|tools/backup/|tools/migrate-postgres.sh|deploy/docker/Dockerfile|\.gitea/workflows/)' <<<"$files"
|
||||
pattern="$common|$native|tests/|$postgres_tools|deploy/docker/Dockerfile"
|
||||
;;
|
||||
deploy)
|
||||
grep -Eq '^(deploy/|tools/ci/deploy-policy-check.py|tools/ops/|tools/backup/|\.gitea/workflows/)' <<<"$files"
|
||||
pattern="$common|deploy/|tools/ops/|tools/backup/|tools/ci/deploy-policy-check\.py|tools/ci/monitoring-check\.sh|tools/ci/ops-lib-check\.sh"
|
||||
;;
|
||||
server-image)
|
||||
grep -Eq '^(CMakeLists.txt|CMakePresets.json|cmake/|include/|src/|apps/|migrations/|tools/prepare-postgres.sh|tools/ci/server-image-smoke.sh|deploy/docker/Dockerfile|\.gitea/workflows/)' <<<"$files"
|
||||
pattern="$common|$native|migrations/|tools/prepare-postgres\.sh|tools/ci/server-image-smoke\.sh|deploy/docker/Dockerfile"
|
||||
;;
|
||||
image)
|
||||
grep -Eq '^(CMakeLists.txt|CMakePresets.json|cmake/|include/|src/|apps/|tests/|deploy/docker/Dockerfile|\.gitea/workflows/)' <<<"$files"
|
||||
pattern="$common|$native|tests/|deploy/docker/Dockerfile"
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
grep -Eq "^($pattern)" <<< "$files"
|
||||
|
||||
Reference in New Issue
Block a user