fix(web): restart the container when a podman secret is rotated #276
Inga granskare
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-infra!276
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "fix/274-web-secret-rotation-restart"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
Closes #274.
Rotating any web podman secret reported
changedand left the running container on the old value.Each secret task now registers its result; a
set_factreduces them toweb_secrets_changed; therestart condition consumes it alongside the existing unit-change and image-drift triggers.
Why not the forgejo pattern
The forgejo role embeds a content hash in the secret name, so a rotation renames the secret, which
rewrites the unit, which trips
web_unit is changed. That would have been the more consistentchoice, and I went the other way for two reasons:
repo prunes them. Seven secrets rotating over a service's lifetime accumulates.
podman_secretcompares the data itself, so the change signal isavailable without encoding it in a name.
Happy to switch to the hashed-name pattern if consistency is preferred — it is a small change either
way.
The
force: truerisk, checked rather than assumedEvery one of these tasks sets
force: true. If that made the module reportchangedunconditionally,this fix would restart the portal on every converge — a much worse bug than the one being fixed.
It does not; the module compares content first. Verified against two real applies from last night:
okchanged, 3okReducer test
The expression has to be false for every not-actually-rotated shape, including ones that arise only
in odd runs. Exercised standalone:
FalseFalse.changedentirelyFalseTrueTrueHence the double default on each item —
(_var | default({})).changed | default(false)— whichcovers both an undefined var and a dict with no
changedkey.Verification
ansible-playbook site.yml --syntax-checkpasses;ansible-lint roles/web/passes on theproduction profile.
--check --diff --tags webagainst prod:ok=12 changed=1 failed=0, the single changed task beingEnable and start bitborg-web. That is pre-existing check-mode noise, not this change —web_running_imageis registered from acommand, which does not run under--check, so emptystdout trips the image-drift branch. The dry-run before this change showed the identical single
task.
--check, sothe secret tasks report
skippingand the fact comes out false. Documented in the role so the nextreader does not mistake that for a broken fix. The real proof is a rotation on a live apply.
Suggested post-merge check
On the next apply with unchanged vault values, confirm
Enable and start bitborg-webreportsok(no spurious restart). The positive case gets proven for free the next time any web secret is
genuinely rotated.