ci: fix Nomad API path and use alloc stop for proper prestart re-run
Some checks are pending
/ deploy (push) Waiting to run

This commit is contained in:
Samuel McCann 2026-06-05 11:34:43 +00:00
parent e1bc2eed6e
commit 5dc0ad9695

View file

@ -16,10 +16,10 @@ jobs:
set -e
ALLOC_ID=$(curl -sf \
-H "X-Nomad-Token: $NOMAD_TOKEN" \
"$NOMAD_ADDR/v1/jobs/thefatdragon/allocations" \
| grep -o '"ID":"[^"]*"' | head -1 | cut -d'"' -f4)
echo "Restarting allocation: $ALLOC_ID"
"$NOMAD_ADDR/v1/job/thefatdragon/allocations" \
| python3 -c "import sys,json; allocs=json.load(sys.stdin); print(next(a['ID'] for a in allocs if a['ClientStatus']=='running'))")
echo "Stopping allocation to trigger fresh prestart: $ALLOC_ID"
curl -sf -X POST \
-H "X-Nomad-Token: $NOMAD_TOKEN" \
"$NOMAD_ADDR/v1/client/allocation/$ALLOC_ID/restart"
echo "Deploy triggered — nginx will re-fetch index.html from git."
"$NOMAD_ADDR/v1/allocation/$ALLOC_ID/stop"
echo "Deploy triggered — Nomad will schedule a new alloc that re-fetches the site."