Resolve main explicitly and schedule auto-deploy on the calendar (Maestro 85cca5ad)
F24-1: resolve refs/remotes/origin/main^{commit} instead of the ambiguous
origin/main, which a tag or local branch of that name would shadow.
F24-2: the timer fires on OnCalendar=*-*-* *:0/15:00 so Persistent=true
catches up a check missed while the host was down; the runbook documents
the new schedule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+3
-2
@@ -269,8 +269,9 @@ release.
|
|||||||
|
|
||||||
[`mealquest-auto-deploy.timer`](systemd/mealquest-auto-deploy.timer) starts
|
[`mealquest-auto-deploy.timer`](systemd/mealquest-auto-deploy.timer) starts
|
||||||
[`mealquest-auto-deploy.service`](systemd/mealquest-auto-deploy.service)
|
[`mealquest-auto-deploy.service`](systemd/mealquest-auto-deploy.service)
|
||||||
2 minutes after the timer starts, then 15 minutes after each run, plus up to
|
at every quarter hour (`OnCalendar=*-*-* *:0/15:00`), plus up to 5 minutes'
|
||||||
5 minutes' random delay. The service runs the script as `overseer` from the
|
random delay; a check missed while the host was down runs as soon as it is
|
||||||
|
back (`Persistent=true`). The service runs the script as `overseer` from the
|
||||||
checkout, and only while `mealquest.service` is active: a stack stopped on
|
checkout, and only while `mealquest.service` is active: a stack stopped on
|
||||||
purpose (a database or media restore) is skipped, not redeployed. Output goes
|
purpose (a database or media restore) is skipped, not redeployed. Output goes
|
||||||
to the journal (`journalctl -u mealquest-auto-deploy`).
|
to the journal (`journalctl -u mealquest-auto-deploy`).
|
||||||
|
|||||||
@@ -51,7 +51,10 @@ git fetch --quiet --tags origin || fail "git fetch origin failed"
|
|||||||
if [ -n "$ref" ]; then
|
if [ -n "$ref" ]; then
|
||||||
target=$(git rev-parse --verify --quiet "$ref^{commit}") || fail "$ref is not a commit in $CHECKOUT"
|
target=$(git rev-parse --verify --quiet "$ref^{commit}") || fail "$ref is not a commit in $CHECKOUT"
|
||||||
else
|
else
|
||||||
target=$(git rev-parse --verify origin/main)
|
# The full remote-tracking ref: a bare origin/main resolves a tag or local
|
||||||
|
# branch of that name first, which could deploy a commit not on main.
|
||||||
|
target=$(git rev-parse --verify --quiet "refs/remotes/origin/main^{commit}") \
|
||||||
|
|| fail "refs/remotes/origin/main is not a commit in $CHECKOUT"
|
||||||
[ -f "$RECORD" ] || fail "no deploy record at $RECORD: seed it with one manual deploy (deploy/RUNBOOK.md \"Automated deploys\")"
|
[ -f "$RECORD" ] || fail "no deploy record at $RECORD: seed it with one manual deploy (deploy/RUNBOOK.md \"Automated deploys\")"
|
||||||
last=$(grep -oE 'deployed=[0-9a-f]{40}' "$RECORD" | tail -n 1 | cut -d = -f 2) || true
|
last=$(grep -oE 'deployed=[0-9a-f]{40}' "$RECORD" | tail -n 1 | cut -d = -f 2) || true
|
||||||
[ -n "$last" ] || fail "$RECORD records no deploy: seed it with one manual deploy (deploy/RUNBOOK.md \"Automated deploys\")"
|
[ -n "$last" ] || fail "$RECORD records no deploy: seed it with one manual deploy (deploy/RUNBOOK.md \"Automated deploys\")"
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
# Checks for a new main every 15 minutes (plus up to 5 minutes' random
|
# Checks for a new main at every quarter hour (plus up to 5 minutes' random
|
||||||
# delay), starting 2 minutes after the timer starts. OnUnitActiveSec= alone
|
# delay). Persistent= runs a check at once when the host comes back if a
|
||||||
# never fires before the service's first run, so OnActiveSec= starts the
|
# scheduled one was missed while it was down.
|
||||||
# cycle at boot and at `enable --now`. Persistent= is set as the task
|
|
||||||
# specified; systemd applies it only to OnCalendar= triggers, so with these
|
|
||||||
# monotonic triggers it has no effect.
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Periodic MealQuest automated deploy
|
Description=Periodic MealQuest automated deploy
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnActiveSec=2min
|
OnCalendar=*-*-* *:0/15:00
|
||||||
OnUnitActiveSec=15min
|
|
||||||
RandomizedDelaySec=5min
|
RandomizedDelaySec=5min
|
||||||
Persistent=true
|
Persistent=true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user