fix(deploy-health): read other repos' main anonymously; never crash on a lookup
Some checks failed
CI / Deploy / PHP Lint (8.2) (push) Successful in 19s
CI / Deploy / PHP Lint (8.1) (push) Successful in 22s
CI / Deploy / PHP Lint (8.3) (push) Successful in 13s
CI / Deploy / PHPCS (WordPress standards) (push) Successful in 25s
Deploy health (daily drift check) / Compare deployed commit with main (push) Failing after 36s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AqpXh3hQMMaC74pTjFq4it
This commit is contained in:
peptiderepo-ops
2026-10-24 11:05:04 +00:00
parent 32daca0717
commit 19f50e25fc

View File

@@ -36,7 +36,12 @@ jobs:
problems="" problems=""
for row in $(python3 -c 'import json; d=json.load(open("tools/gitea-pipeline/repos.json")); [print(k+"="+v["target_path"]) for k,v in d.items() if not k.startswith("_") and v.get("target_path")]'); do for row in $(python3 -c 'import json; d=json.load(open("tools/gitea-pipeline/repos.json")); [print(k+"="+v["target_path"]) for k,v in d.items() if not k.startswith("_") and v.get("target_path")]'); do
repo=${row%%=*}; tp=${row#*=}; slug=$(printf '%s' "$tp" | tr '/' '_') repo=${row%%=*}; tp=${row#*=}; slug=$(printf '%s' "$tp" | tr '/' '_')
head=$(curl -s -H "$H" "$API/repos/peptide-repo/$repo/branches/main" | python3 -c 'import json,sys;print(json.load(sys.stdin)["commit"]["id"])') # The job token is scoped to peptide-e2e; the repos are public, so read
# their branches anonymously. Unreadable main = a problem, not a crash.
head=$(curl -s "$API/repos/peptide-repo/$repo/branches/main" | python3 -c 'import json,sys
try: print(json.load(sys.stdin)["commit"]["id"])
except Exception: print("")')
if [ -z "$head" ]; then problems="$problems\n- $repo: could not read main from Gitea"; continue; fi
stamp=$(ssh $SSHOPT "$SSH_USERNAME@$SSH_HOST" "cat ~/.peptide-deploys/production/$slug 2>/dev/null" || true) stamp=$(ssh $SSHOPT "$SSH_USERNAME@$SSH_HOST" "cat ~/.peptide-deploys/production/$slug 2>/dev/null" || true)
dep=${stamp%% *} dep=${stamp%% *}
if [ -z "$dep" ]; then if [ -z "$dep" ]; then