Files
aevolution/tools/ci/ci-paths.sh
T
dingoandClaude Opus 5.5 3a34ae39bc 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>
2026-09-30 22:53:11 -04:00

56 lines
2.3 KiB
Bash
Executable File

#!/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}
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
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)
pattern="$common|$native|tests/|experiments/|tools/ci/linux-check\.sh|tools/ci/tsan-profile\.mjs|deploy/docker/Dockerfile"
;;
postgres|postgres-tools)
pattern="$common|$native|tests/|$postgres_tools|deploy/docker/Dockerfile"
;;
deploy)
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)
pattern="$common|$native|migrations/|tools/prepare-postgres\.sh|tools/ci/server-image-smoke\.sh|deploy/docker/Dockerfile"
;;
image)
pattern="$common|$native|tests/|deploy/docker/Dockerfile"
;;
*)
exit 0
;;
esac
grep -Eq "^($pattern)" <<< "$files"