Force fresh Nomad allocation on deploy
All checks were successful
/ deploy (push) Successful in 48s

This commit is contained in:
Loyyd 2026-07-12 17:34:34 +02:00
parent d018392c14
commit 3740ce4ac8

View file

@ -69,27 +69,27 @@ jobs:
test -f dist/speeches/index.html test -f dist/speeches/index.html
test -f dist/assets/icons/familyfed-favicon.png test -f dist/assets/icons/familyfed-favicon.png
ALLOC_ID=$( export DEPLOY_COMMIT="${GITHUB_SHA:-$(git rev-parse HEAD)}"
curl -fsS \ echo "Registering Nomad deployment for $DEPLOY_COMMIT"
--connect-timeout 15 \ curl -fsS \
--max-time 60 \
--retry 3 \
--retry-delay 5 \
--retry-all-errors \
-H "X-Nomad-Token: $NOMAD_TOKEN" \
"$NOMAD_ADDR/v1/job/familyfed/allocations" \
| jq -r 'map(select(.ClientStatus == "running"))[0].ID'
)
test -n "$ALLOC_ID"
test "$ALLOC_ID" != "null"
echo "Stopping allocation to trigger fresh prestart: $ALLOC_ID"
curl -fsS -X POST \
--connect-timeout 15 \ --connect-timeout 15 \
--max-time 60 \ --max-time 60 \
--retry 3 \ --retry 3 \
--retry-delay 5 \ --retry-delay 5 \
--retry-all-errors \ --retry-all-errors \
-H "X-Nomad-Token: $NOMAD_TOKEN" \ -H "X-Nomad-Token: $NOMAD_TOKEN" \
"$NOMAD_ADDR/v1/allocation/$ALLOC_ID/stop" "$NOMAD_ADDR/v1/job/familyfed" \
echo "Deploy triggered. Nomad will schedule a new alloc that re-fetches the site." | jq '(.TaskGroups[].Tasks[].Env //= {}) | .TaskGroups[].Tasks[].Env.DEPLOY_COMMIT = env.DEPLOY_COMMIT | {Job: .}' \
> /tmp/familyfed-job.json
curl -fsS -X POST \
--connect-timeout 15 \
--max-time 60 \
--retry 3 \
--retry-delay 5 \
--retry-all-errors \
-H "Content-Type: application/json" \
-H "X-Nomad-Token: $NOMAD_TOKEN" \
--data-binary @/tmp/familyfed-job.json \
"$NOMAD_ADDR/v1/jobs"
echo "Deploy registered. Nomad will replace the allocation and re-fetch the site."