fix(forgejo): defer the oidc source when the idp is unreachable on a fresh host #656

Sammanfogat
supernaut sammanfogade 1 incheckning från fix/fresh-host-image-bootstrap in i main 2026-10-11 09:35:39 +00:00
Ägare

Refs #613.

The Keycloak image part of #613 is done by #641 and #643. This fixes a second first-pass blocker.

The forgejo role runs before caddy. On a fresh host nothing serves the identity provider's discovery URL yet, so forgejo admin auth add-oauth exits 1 (Failed to initialize OpenID Connect Provider ... connection refused) and aborts the play. That hits every rebuild with the client secret vaulted, and a fresh staging host today. Forgejo creates no source on that error, so a retry starts clean.

  • oidc-source.yml: the add tolerates only that error and prints a note to run site.yml again. Any other error stays fatal.
  • The update path stays fatal. It runs only on real drift, and a restored database matches the declared settings.
  • Runbook stand-up step 5: the second pass also adds the OIDC source.

Rebuild order: pass 1 (clean stack, Keycloak staged, source deferred), restore the databases and the storage tier, pass 2 (Keycloak starts, source added).

Still open: a from-scratch stand-up with no restored realm fails the end-of-run health gate on realm discovery. It needs the opentofu/keycloak realm apply between the passes.

Checked: reproduced the error in a throwaway forgejo:16.0.5-rootless container; a scratch playbook shows the error tolerated and any other error fatal; ansible-playbook site.yml --syntax-check; ansible-lint; pre-push hooks. Not tested on a real fresh host.

Refs #613. The Keycloak image part of #613 is done by #641 and #643. This fixes a second first-pass blocker. The forgejo role runs before caddy. On a fresh host nothing serves the identity provider's discovery URL yet, so `forgejo admin auth add-oauth` exits 1 (`Failed to initialize OpenID Connect Provider ... connection refused`) and aborts the play. That hits every rebuild with the client secret vaulted, and a fresh staging host today. Forgejo creates no source on that error, so a retry starts clean. - `oidc-source.yml`: the add tolerates only that error and prints a note to run `site.yml` again. Any other error stays fatal. - The update path stays fatal. It runs only on real drift, and a restored database matches the declared settings. - Runbook stand-up step 5: the second pass also adds the OIDC source. Rebuild order: pass 1 (clean stack, Keycloak staged, source deferred), restore the databases and the storage tier, pass 2 (Keycloak starts, source added). Still open: a from-scratch stand-up with no restored realm fails the end-of-run health gate on realm discovery. It needs the `opentofu/keycloak` realm apply between the passes. Checked: reproduced the error in a throwaway `forgejo:16.0.5-rootless` container; a scratch playbook shows the error tolerated and any other error fatal; `ansible-playbook site.yml --syntax-check`; ansible-lint; pre-push hooks. Not tested on a real fresh host.
supernaut lade till 1 incheckning 2026-10-11 09:22:09 +00:00
fix(forgejo): defer the oidc source when the idp is unreachable on a fresh host
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m54s
209e426458
The forgejo role runs before caddy and the identity provider start. With the
client secret already vaulted, `forgejo admin auth add-oauth` fails on the
discovery fetch and aborts the first site.yml pass of a rebuild.

Tolerate only that error on the add, note it, and let the second pass add the
source. Forgejo creates no source when discovery fails, so the retry is clean.
The update path stays loud.

Refs #613
supernaut tvångsskickade fix/fresh-host-image-bootstrap från 209e426458
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m54s
till 52caac40d0
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m49s
2026-10-11 09:33:15 +00:00
Jämför
supernaut schemalade den här ändringsförfrågan för automatisk sammanfogning när alla kontroller lyckas 2026-10-11 09:33:18 +00:00
supernaut sammanfogade incheckning 7c00f1aca3 till main 2026-10-11 09:35:39 +00:00
supernaut tog bort grenen fix/fresh-host-image-bootstrap 2026-10-11 09:35:39 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-infra!656
Ingen beskrivning angiven.