Add global lock to serialize CI runs across branches

Multiple simultaneous test runs compete for PostgreSQL connections,
causing spurious errors. Global flock ensures one branch runs at a time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude BM 2026-04-21 09:20:11 +00:00
parent b8c4fe7cc2
commit ec02b57adc

View File

@ -31,6 +31,11 @@ if ! flock -n 200; then
exit 0 exit 0
fi fi
# Serialize all CI runs to avoid DB connection contention
GLOBAL_LOCK="/tmp/tsharps-ci-global.lock"
exec 201>"$GLOBAL_LOCK"
flock 201
echo "=== TSHARPS CI Runner ===" echo "=== TSHARPS CI Runner ==="
echo "Branch: $BRANCH" echo "Branch: $BRANCH"
echo "Commit: $COMMIT" echo "Commit: $COMMIT"