Upgrade Forgejo to v17 #716

Stängd
öppnade 2026-10-13 09:27:59 +00:00 av supernaut · 19 kommentarer
Ägare

Upgrade Forgejo from 16.0.x to v17 once v17.0.0 is tagged (due 2026-10-15). Take the newest v17.0.x patch.

The upgrade is one-way. v17 drops watch.mode and adds six schema migrations, so a v16 binary will not start on the migrated database. Rollback is a restore of the pre-upgrade backup.

Before:

  • Re-check the source diff against the final tag.
  • Count package_version rows. The total_size backfill runs one query per version at first start, inside TimeoutStartSec=300. Run registry retention first.
  • List pull mirrors with http:// or git:// remotes. [migrations] ALLOW_UNENCRYPTED now defaults to false. Keep it false and tell those owners.
  • Make sure the system webhook sends only repository events, so the new workflow_run_* and workflow_job_* events do not trigger extra reconciles.
  • Full backup, confirmed restorable.

Staging:

  • Apply with -e forgejo_image_tag=<v17>-rootless and the matching verified tag.
  • Hand-check identity concealment: /user/settings has no Full Name, /user/settings/account has no "Set as primary".
  • Check sign-out (now a POST form), alert blocks in light and dark themes, and a runner job.

Prod:

  • Commit forgejo_image_tag and health_check_forgejo_concealment_verified_tag together, apply --tags registry-mirror,forgejo.
  • After: the runner controller's queued-jobs metric is not -1 (the admin job list now loads each job), gitea_* metrics are present, sign-in works, no translation alert.
  • Fresh backup before the next weekly drill.
  • Re-check the forgejo.org/docs links in the portal's Actions docs and the runbook.

Do not set [service] USERNAME_PREFIX: it also applies to OIDC accounts. Code search stays off: the per-repo indexer toggle is not in v17.

Upgrade Forgejo from 16.0.x to v17 once v17.0.0 is tagged (due 2026-10-15). Take the newest v17.0.x patch. The upgrade is one-way. v17 drops `watch.mode` and adds six schema migrations, so a v16 binary will not start on the migrated database. Rollback is a restore of the pre-upgrade backup. Before: - [x] Re-check the source diff against the final tag. - [x] Count `package_version` rows. The `total_size` backfill runs one query per version at first start, inside `TimeoutStartSec=300`. Run registry retention first. - [x] List pull mirrors with `http://` or `git://` remotes. `[migrations] ALLOW_UNENCRYPTED` now defaults to false. Keep it false and tell those owners. - [x] Make sure the system webhook sends only repository events, so the new `workflow_run_*` and `workflow_job_*` events do not trigger extra reconciles. - [x] Full backup, confirmed restorable. Staging: - [x] Apply with `-e forgejo_image_tag=<v17>-rootless` and the matching verified tag. - [x] Hand-check identity concealment: `/user/settings` has no Full Name, `/user/settings/account` has no "Set as primary". - [ ] Check sign-out (now a POST form), alert blocks in light and dark themes, and a runner job. Prod: - [x] Commit `forgejo_image_tag` and `health_check_forgejo_concealment_verified_tag` together, apply `--tags registry-mirror,forgejo`. - [x] After: the runner controller's queued-jobs metric is not -1 (the admin job list now loads each job), `gitea_*` metrics are present, sign-in works, no translation alert. - [x] Fresh backup before the next weekly drill. - [ ] Re-check the `forgejo.org/docs` links in the portal's Actions docs and the runbook. Do not set `[service] USERNAME_PREFIX`: it also applies to OIDC accounts. Code search stays off: the per-repo indexer toggle is not in v17.
Upphovsperson
Ägare

No longer a prerequisite of the rename (#584). The rename ran on 2026-10-15, so this upgrade runs on the renamed hosts once v17.0.0 is tagged.

No longer a prerequisite of the rename (#584). The rename ran on 2026-10-15, so this upgrade runs on the renamed hosts once v17.0.0 is tagged.
Upphovsperson
Ägare

Upgrade plan for v17.0.0 (17.0.0-rootless, released 2026-10-15). v16 support ends 2026-10-29.

Must fix first

  • Sign-out (#646). v17 submits sign-out as a form and SignOut answers 303 to / (was 200 JSON for fetch()). The Caddy intercept on git.* matches only status 200, so on v17 the bitborg_sso_logout cookie and the Keycloak end-session redirect are skipped, and the next "Sign in" is silent. Fix: add a 303 branch next to the 200 one (both until prod runs v17) that sets the cookie and redirects to /user/sso-logout. Extend test_frontchannel_logout.sh with a stub that answers 303.
  • Front-channel logout (#756). The iframe now follows a 303 to /, which carries X-Frame-Options: SAMEORIGIN. The logout still happens; check on staging that Keycloak's logout page completes.

Checked, not affected or already gated

  • Concealment selectors in bitborg.css still match v17 markup; the health-check pin gates the bump. Hand-check on staging.
  • --color-primary-dark-5/6/7 are gone (PR13224): dead lines in bitborg.css, harmless.
  • [migrations] ALLOW_UNENCRYPTED defaults to false (PR13490): http:///git:// mirrors stop. Count them first.
  • actor is reserved (PR13077): check no account has it.
  • Strict durations (PR10273), log file rename, JWT changes (PR12307), indexer config split, admin and package APIs, backup format, metrics, Renovate: not affected.
  • Correction to this issue: watch.mode was dropped by a v16 migration, not v17. Forgejo's unit has no Notify=, so TimeoutStartSec does not bound migrations; the role's CLI retries do.

Migrations

Six additive v17a_* migrations. Only the package_version.total_size backfill grows with data (one update per version). Not reversible: v16 refuses a v17 database, so rollback is a restore.

Order

  1. Caddy fix plus stub test on main, applied to staging and prod (prod v16 keeps using the 200 branch).
  2. Read-only pre-checks on prod: package version count, unencrypted mirrors, actor, action_run webhooks, system webhook events.
  3. Staging: bump, watch the six migrations, post-checks (sign-in, sign-out both ways, concealment, themes, Actions job, package push/pull, LFS, SSH on 22, HTTPS clone, metrics, reconciler).
  4. Prod window: fresh backup, pause hot backup and retention, Cinder snapshots of data and LFS with Forgejo stopped, flush queues, apply --tags registry-mirror,forgejo, same post-checks.
  5. Rollback: stop writers, pin back to 16.0.6-rootless, restore the Forgejo database and forgejo-data from the pre-upgrade archive, apply. Cinder revert only as fallback.

Opportunities after the upgrade: package quota no longer counts shared blobs per tag (PR14221), workflow_job webhooks for the runner controller (PR14334, #718), safer OIDC group mappings for #77 (PR13056), probable fix for the Zoekt 500 (PR13811; PR 8106 still open, search stays off).

Upgrade plan for v17.0.0 (`17.0.0-rootless`, released 2026-10-15). v16 support ends 2026-10-29. ## Must fix first - **Sign-out (#646).** v17 submits sign-out as a form and `SignOut` answers `303` to `/` (was `200` JSON for `fetch()`). The Caddy intercept on `git.*` matches only `status 200`, so on v17 the `bitborg_sso_logout` cookie and the Keycloak end-session redirect are skipped, and the next "Sign in" is silent. Fix: add a `303` branch next to the `200` one (both until prod runs v17) that sets the cookie and redirects to `/user/sso-logout`. Extend `test_frontchannel_logout.sh` with a stub that answers `303`. - **Front-channel logout (#756).** The iframe now follows a `303` to `/`, which carries `X-Frame-Options: SAMEORIGIN`. The logout still happens; check on staging that Keycloak's logout page completes. ## Checked, not affected or already gated - Concealment selectors in `bitborg.css` still match v17 markup; the health-check pin gates the bump. Hand-check on staging. - `--color-primary-dark-5/6/7` are gone (PR13224): dead lines in `bitborg.css`, harmless. - `[migrations] ALLOW_UNENCRYPTED` defaults to false (PR13490): `http://`/`git://` mirrors stop. Count them first. - `actor` is reserved (PR13077): check no account has it. - Strict durations (PR10273), log file rename, JWT changes (PR12307), indexer config split, admin and package APIs, backup format, metrics, Renovate: not affected. - Correction to this issue: `watch.mode` was dropped by a v16 migration, not v17. Forgejo's unit has no `Notify=`, so `TimeoutStartSec` does not bound migrations; the role's CLI retries do. ## Migrations Six additive `v17a_*` migrations. Only the `package_version.total_size` backfill grows with data (one update per version). Not reversible: v16 refuses a v17 database, so rollback is a restore. ## Order 1. Caddy fix plus stub test on `main`, applied to staging and prod (prod v16 keeps using the `200` branch). 2. Read-only pre-checks on prod: package version count, unencrypted mirrors, `actor`, `action_run` webhooks, system webhook events. 3. Staging: bump, watch the six migrations, post-checks (sign-in, sign-out both ways, concealment, themes, Actions job, package push/pull, LFS, SSH on 22, HTTPS clone, metrics, reconciler). 4. Prod window: fresh backup, pause hot backup and retention, Cinder snapshots of data and LFS with Forgejo stopped, flush queues, apply `--tags registry-mirror,forgejo`, same post-checks. 5. Rollback: stop writers, pin back to `16.0.6-rootless`, restore the Forgejo database and `forgejo-data` from the pre-upgrade archive, apply. Cinder revert only as fallback. Opportunities after the upgrade: package quota no longer counts shared blobs per tag (PR14221), `workflow_job` webhooks for the runner controller (PR14334, #718), safer OIDC group mappings for #77 (PR13056), probable fix for the Zoekt 500 (PR13811; PR 8106 still open, search stays off).
Upphovsperson
Ägare

Decision 2026-10-17: add a 303 branch next to the 200 branch in the sign-out intercept, with a 303 stub test. Remove the 200 branch once prod runs v17. The front-channel 204 tweak only if staging shows Keycloak's logout page hanging.

Decision 2026-10-17: add a `303` branch next to the `200` branch in the sign-out intercept, with a `303` stub test. Remove the `200` branch once prod runs v17. The front-channel `204` tweak only if staging shows Keycloak's logout page hanging.
Upphovsperson
Ägare

Prod pre-checks 2026-10-17 (read-only SQL): 234 package versions, so the total_size backfill is trivial. 0 pull mirrors, no http:///git:// push mirrors, no actor account. No webhook enables an action_run event. The system webhook (id 6) enables repository only. Nothing to notify. ALLOW_UNENCRYPTED stays at its default (false).

Prod pre-checks 2026-10-17 (read-only SQL): 234 package versions, so the `total_size` backfill is trivial. 0 pull mirrors, no `http://`/`git://` push mirrors, no `actor` account. No webhook enables an `action_run` event. The system webhook (id 6) enables `repository` only. Nothing to notify. `ALLOW_UNENCRYPTED` stays at its default (false).
Upphovsperson
Ägare

Decision 2026-10-17: rollback is targeted by default. Restore the Forgejo database and forgejo-data from the pre-upgrade archive, and leave the other databases alone. A Cinder snapshot revert is the fallback only.

Decision 2026-10-17: rollback is targeted by default. Restore the Forgejo database and `forgejo-data` from the pre-upgrade archive, and leave the other databases alone. A Cinder snapshot revert is the fallback only.
Upphovsperson
Ägare

Decision 2026-10-17: pause bitborg-backup-hot.timer and bitborg-registry-retention.timer for the prod window. Hot backup resumes after the post-checks. Retention resumes after 24 h without a rollback.

Decision 2026-10-17: pause `bitborg-backup-hot.timer` and `bitborg-registry-retention.timer` for the prod window. Hot backup resumes after the post-checks. Retention resumes after 24 h without a rollback.
Upphovsperson
Ägare

Decision 2026-10-17: delete the unused per-repo pulls patch directories (PR13800) one week after the prod upgrade, once a rollback is off the table. The operator runs the command.

Decision 2026-10-17: delete the unused per-repo `pulls` patch directories (PR13800) one week after the prod upgrade, once a rollback is off the table. The operator runs the command.
Upphovsperson
Ägare

Decision 2026-10-17: staging upgrade now. Prod as soon as staging passes all post-checks. The Caddy 303 fix lands and is applied on both envs first.

Decision 2026-10-17: staging upgrade now. Prod as soon as staging passes all post-checks. The Caddy `303` fix lands and is applied on both envs first.
Upphovsperson
Ägare

Staging on v17.0.0 since 2026-10-17 13:41 UTC. The six v17a_* migrations ran in under 1 s and Forgejo listened 4 s after the restart. The health gate passed. healthz, login redirect, API version, anonymous clone and the reconciler run are fine.

Blocker for prod: forgejo doctor check (default suite) reports [E] Log Root Path /var/lib/gitea/log ... not accessible. We log to the console, and v16 created the directory as a side effect of CLI runs, while v17 does not. The restore drill fails on any [E]. Decision: the forgejo role creates the log root in forgejo-data, so hosts and restored backups have it. That lands before the prod bump.

Staging on v17.0.0 since 2026-10-17 13:41 UTC. The six `v17a_*` migrations ran in under 1 s and Forgejo listened 4 s after the restart. The health gate passed. healthz, login redirect, API version, anonymous clone and the reconciler run are fine. Blocker for prod: `forgejo doctor check` (default suite) reports `[E] Log Root Path /var/lib/gitea/log ... not accessible`. We log to the console, and v16 created the directory as a side effect of CLI runs, while v17 does not. The restore drill fails on any `[E]`. Decision: the forgejo role creates the log root in `forgejo-data`, so hosts and restored backups have it. That lands before the prod bump.
Upphovsperson
Ägare

Staging v17 browser checks, 2026-10-17 (Chrome):

  • Forgejo sign-out (v17 form POST, #762): POST /user/logout 303, GET /user/sso-logout 302 to the Keycloak logout, confirm, then the front-channel ping. The next "Sign in" shows the Keycloak login form. Pass.
  • Portal sign-out (front-channel, #756): the iframe GET /user/frontchannel-logout now gets 303 to / (was 200 on v16). Keycloak's logout page completed and returned to the portal, and Forgejo was signed out. The sign-out intercept did not fire inside the iframe. The optional 204 tweak is not needed. Pass.
  • Concealment: Full Name hidden (display: none). On an account with three emails, both "Set as primary" forms are present with display: none, 0 visible. Pass.
  • Dark theme: info block renders correctly. Light theme not checked.

Still open: the doctor [E] (#763), and Actions job, package push/pull, LFS, SSH push on 22, HTTPS token clone, metrics.

Staging v17 browser checks, 2026-10-17 (Chrome): - Forgejo sign-out (v17 form POST, #762): `POST /user/logout` `303`, `GET /user/sso-logout` `302` to the Keycloak logout, confirm, then the front-channel ping. The next "Sign in" shows the Keycloak login form. Pass. - Portal sign-out (front-channel, #756): the iframe `GET /user/frontchannel-logout` now gets `303` to `/` (was `200` on v16). Keycloak's logout page completed and returned to the portal, and Forgejo was signed out. The sign-out intercept did not fire inside the iframe. The optional `204` tweak is not needed. Pass. - Concealment: Full Name hidden (`display: none`). On an account with three emails, both "Set as primary" forms are present with `display: none`, 0 visible. Pass. - Dark theme: info block renders correctly. Light theme not checked. Still open: the doctor `[E]` (#763), and Actions job, package push/pull, LFS, SSH push on 22, HTTPS token clone, metrics.
Upphovsperson
Ägare

#763 applied on staging: Ensure the Forgejo log root exists reported changed once, and forgejo doctor check now has 0 [E] (5 checks). Doctor blocker resolved.

#763 applied on staging: `Ensure the Forgejo log root exists` reported `changed` once, and `forgejo doctor check` now has 0 `[E]` (5 checks). Doctor blocker resolved.
Upphovsperson
Ägare

Staging v17, operator machine 2026-10-17: SSH clone and push on 22, LFS push, a fresh SSH clone with LFS pull. Both objects match. Pass. The HTTPS token clone failed with 401. That points at the token: services/auth/method/basic.go is unchanged from v16. Token auth is checked on prod by the registry-mirror and CI pushes with the bitborg-ci token. Actions can only be checked on prod (staging has no runners).

Staging v17, operator machine 2026-10-17: SSH clone and push on 22, LFS push, a fresh SSH clone with LFS pull. Both objects match. Pass. The HTTPS token clone failed with 401. That points at the token: `services/auth/method/basic.go` is unchanged from v16. Token auth is checked on prod by the registry-mirror and CI pushes with the `bitborg-ci` token. Actions can only be checked on prod (staging has no runners).
supernaut refererade till detta ärende från en incheckning 2026-10-17 15:14:29 +00:00
supernaut refererade till detta ärende från en incheckning 2026-10-17 15:18:36 +00:00
Upphovsperson
Ägare

Prod upgraded to 17.0.0 on 2026-10-17 (#764, window 15:25-15:32 UTC).

  • Pre-window: fresh backup bitborg-20261017T152530Z.tar.age (success), hot backup and retention timers paused, Cinder snapshots pre-v17-gitborg-prod-{data,lfs}-20261017 available.
  • Apply --tags registry-mirror,forgejo: reconciled clean (4 predicted, 1 known-blind extra). Six v17a_* migrations at 15:31:04-05, listening 15:31:05. A second --check gave changed=0.
  • Post-checks, all pass: version 17.0.0, doctor 0 [E], healthz 200, all health gates incl. concealment, 8/8 probes up, no new alerts (RenovateUpdateHeldTooLong is renovate/victoriametrics, older). Registry mirror run succeeded (token auth). Runner controller queued-jobs metric 0. A CI re-run (run 1095 attempt 2) succeeded on v17. The reconciler had one failed run at 15:31:02 with 502s during the restart. The next run at 15:32:34 completed, status 0.
  • Browser: concealment (Full Name, "Set as primary") hidden. Portal sign-out: front-channel iframe 303, Forgejo signed out. Forgejo sign-out: 303 path to Keycloak logout, the next sign-in shows the form.

Left:

  • Hot backup timer on (operator, now).
  • Registry retention timer on after 24 h without a rollback (from 2026-10-18 15:32 UTC).
  • 2026-10-24 or later: delete the unused per-repo pulls patch directories.
  • Remove the 200 branch of the sign-out intercept (#762).
  • Runbook: a short v17 section.
Prod upgraded to 17.0.0 on 2026-10-17 (#764, window 15:25-15:32 UTC). - Pre-window: fresh backup `bitborg-20261017T152530Z.tar.age` (success), hot backup and retention timers paused, Cinder snapshots `pre-v17-gitborg-prod-{data,lfs}-20261017` available. - Apply `--tags registry-mirror,forgejo`: reconciled clean (4 predicted, 1 known-blind extra). Six `v17a_*` migrations at 15:31:04-05, listening 15:31:05. A second `--check` gave `changed=0`. - Post-checks, all pass: version 17.0.0, doctor 0 `[E]`, healthz 200, all health gates incl. concealment, 8/8 probes up, no new alerts (`RenovateUpdateHeldTooLong` is `renovate/victoriametrics`, older). Registry mirror run succeeded (token auth). Runner controller queued-jobs metric 0. A CI re-run (run 1095 attempt 2) succeeded on v17. The reconciler had one failed run at 15:31:02 with 502s during the restart. The next run at 15:32:34 completed, status 0. - Browser: concealment (Full Name, "Set as primary") hidden. Portal sign-out: front-channel iframe `303`, Forgejo signed out. Forgejo sign-out: `303` path to Keycloak logout, the next sign-in shows the form. Left: - [ ] Hot backup timer on (operator, now). - [ ] Registry retention timer on after 24 h without a rollback (from 2026-10-18 15:32 UTC). - [ ] 2026-10-24 or later: delete the unused per-repo `pulls` patch directories. - [ ] Remove the `200` branch of the sign-out intercept (#762). - [ ] Runbook: a short v17 section.
Upphovsperson
Ägare

Hot backup timer back on 2026-10-17. Next run 16:17:15 UTC. Registry retention stays paused until 2026-10-18 15:32 UTC.

Hot backup timer back on 2026-10-17. Next run 16:17:15 UTC. Registry retention stays paused until 2026-10-18 15:32 UTC.
Upphovsperson
Ägare

#765 applied 2026-10-17. Staging changed=4, prod changed=4, matching the dry run exactly. A second prod --check gave changed=0. Raw POST /user/logout on both envs: 303 with Location: /user/sso-logout and the bitborg_sso_logout cookie (the intercept now has only the 303 branch). The prod browser sign-out check follows.

#765 applied 2026-10-17. Staging `changed=4`, prod `changed=4`, matching the dry run exactly. A second prod `--check` gave `changed=0`. Raw `POST /user/logout` on both envs: `303` with `Location: /user/sso-logout` and the `bitborg_sso_logout` cookie (the intercept now has only the `303` branch). The prod browser sign-out check follows.
Upphovsperson
Ägare

Prod browser check after #765: Forgejo sign-out reaches the Keycloak logout (client_id=forgejo), and the next sign-in shows the login form. Left on this issue: retention on after 2026-10-18 15:32 UTC, and the pulls dir cleanup from 2026-10-24.

Prod browser check after #765: Forgejo sign-out reaches the Keycloak logout (`client_id=forgejo`), and the next sign-in shows the login form. Left on this issue: retention on after 2026-10-18 15:32 UTC, and the `pulls` dir cleanup from 2026-10-24.
Upphovsperson
Ägare

The first restore drill after the bump failed (2026-10-17 17:41 UTC): forgejo migrate refused the v17 database. Cause: the window applied only --tags registry-mirror,forgejo, so the drill orchestrator still pinned 16.0.6-rootless (backup_drill_forgejo_image derives from forgejo_image_tag). The podman image-prune keep list was stale too. A full site.yml --check on prod shows exactly these two changes. Fix: apply --tags backup-drill,podman, then rerun the drill. The restore itself was fine: the DBs, Keycloak, the Forgejo volume and both restic legs restored from the new bucket.

The first restore drill after the bump failed (2026-10-17 17:41 UTC): `forgejo migrate` refused the v17 database. Cause: the window applied only `--tags registry-mirror,forgejo`, so the drill orchestrator still pinned `16.0.6-rootless` (`backup_drill_forgejo_image` derives from `forgejo_image_tag`). The podman image-prune keep list was stale too. A full `site.yml --check` on prod shows exactly these two changes. Fix: apply `--tags backup-drill,podman`, then rerun the drill. The restore itself was fine: the DBs, Keycloak, the Forgejo volume and both restic legs restored from the new bucket.
supernaut refererade till detta ärende från en incheckning 2026-10-19 18:56:17 +00:00
Upphovsperson
Ägare

Status 2026-10-24.

  • The scheduled weekly drill passed on v17: bitborg_backup_drill_last_run_status 0, hot and Keycloak legs 0, success at 06:13 UTC.
  • Registry retention is back on: last run 2026-10-23 22:12 UTC, status 0, not capped.

Left: delete the unused per-repo pulls dirs (operator), then close.

Status 2026-10-24. - The scheduled weekly drill passed on v17: `bitborg_backup_drill_last_run_status` 0, hot and Keycloak legs 0, success at 06:13 UTC. - Registry retention is back on: last run 2026-10-23 22:12 UTC, status 0, not capped. Left: delete the unused per-repo `pulls` dirs (operator), then close.
Upphovsperson
Ägare

Pulls dir cleanup, 2026-10-25: nothing to delete. A read-only search of the prod Forgejo data volume found 0 pulls directories and 0 *.patch files across all 15 repositories. The per-repo <repo>.git/pulls/<N>.patch files were only written by the migration uploader, which stopped doing so in Forgejo PR 13800. Every item on this issue is done. Closing.

Pulls dir cleanup, 2026-10-25: nothing to delete. A read-only search of the prod Forgejo data volume found 0 `pulls` directories and 0 `*.patch` files across all 15 repositories. The per-repo `<repo>.git/pulls/<N>.patch` files were only written by the migration uploader, which stopped doing so in Forgejo PR 13800. Every item on this issue is done. Closing.
Logga in för att delta i denna konversation.
Ingen milstolpe
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#716
Ingen beskrivning angiven.