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,7 +69,8 @@ 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)}"
echo "Registering Nomad deployment for $DEPLOY_COMMIT"
curl -fsS \ curl -fsS \
--connect-timeout 15 \ --connect-timeout 15 \
--max-time 60 \ --max-time 60 \
@ -77,19 +78,18 @@ jobs:
--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/job/familyfed/allocations" \ "$NOMAD_ADDR/v1/job/familyfed" \
| jq -r 'map(select(.ClientStatus == "running"))[0].ID' | jq '(.TaskGroups[].Tasks[].Env //= {}) | .TaskGroups[].Tasks[].Env.DEPLOY_COMMIT = env.DEPLOY_COMMIT | {Job: .}' \
) > /tmp/familyfed-job.json
test -n "$ALLOC_ID"
test "$ALLOC_ID" != "null"
echo "Stopping allocation to trigger fresh prestart: $ALLOC_ID"
curl -fsS -X POST \ 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 "Content-Type: application/json" \
-H "X-Nomad-Token: $NOMAD_TOKEN" \ -H "X-Nomad-Token: $NOMAD_TOKEN" \
"$NOMAD_ADDR/v1/allocation/$ALLOC_ID/stop" --data-binary @/tmp/familyfed-job.json \
echo "Deploy triggered. Nomad will schedule a new alloc that re-fetches the site." "$NOMAD_ADDR/v1/jobs"
echo "Deploy registered. Nomad will replace the allocation and re-fetch the site."