Deploy: install exactly the tested commit, refuse replays, roll back if unhealthy (#55, part 2) #77

Merged
jared merged 1 commits from deploy-pinned into main 2026-11-29 00:31:17 -05:00
1 Commits
Author SHA1 Message Date
jaredandClaude Opus 5.5 6e18a3262a Deploy: install exactly the tested commit, refuse replays, roll back if unhealthy
CI / Lint (JS) (pull_request) Successful in 12s
CI / Lint (Python) (pull_request) Successful in 35s
CI / Test (pull_request) Successful in 59s
CI / Security (pull_request) Successful in 39s
CI / Scan (pull_request) Successful in 29s
CI / Deploy (pull_request) Skipped
CI / Notify (pull_request) Skipped
gandalf#55, part 2 (the server side; needs installing on CT 157).

deploy/gandalf_deploy.sh <sha> <ts>, run by the gandalf-deploy webhook
from its installed copy /usr/local/bin/gandalf_app_deploy.sh:
- refuses a request signed more than 5 minutes ago, or one not newer
  than the last accepted (replay), and any sha not on origin/main;
- checks out exactly that sha (detached), installs requirements.txt and
  restarts gandalf and gandalf-monitor;
- waits for /health to report the sha for both with status ok, and rolls
  back to the previous commit otherwise; one deploy at a time (flock).

tests/test_deploy_script.py runs the real script in a sandbox with fake
systemctl, pip3 and curl: exact commit, untracked config.json kept,
replay, stale, off-main and malformed requests refused, an unhealthy
build rolled back, and the running commit a no-op.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-28 23:54:43 -05:00