Move active CI tooling into scripts and archive plans
This commit is contained in:
@@ -21,3 +21,5 @@ that did it is `../cc-ci-plan/plan-cc-ci-combined-host.md`).
|
||||
The cc-ci server's own history (machine-docs, decisions, the clean-room rebuild that proved
|
||||
"two repos + one age key + one `nixos-rebuild switch`") is in the cc-ci repo under
|
||||
`machine-docs/` and `docs/`.
|
||||
|
||||
Current CI plans formerly under `cc-ci-plan/` are in `plans/cc-ci-plan/`.
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
# Policy + cleanup — cc-ci compose overlays (when they're justified) & upgrade-tier from-version
|
||||
|
||||
**Status:** POLICY (codifies `plan.md §9`) + a small set of follow-ups. **Owner:** Builder + Adversary.
|
||||
**This file:** `/srv/cc-ci/cc-ci-plan/plan-ccci-compose-overlay-policy.md`
|
||||
**Supersedes** the earlier `plan-prefer-env-over-compose-overlay.md` (its premise — parameterize
|
||||
`start_period` via an env var — is **wrong: abra does not support an env value for `start_period`**).
|
||||
|
||||
---
|
||||
|
||||
## 0. Policy (operator, 2026-05-30)
|
||||
|
||||
A cc-ci-authored compose overlay (the single `compose.ccci.yml`, layered via `COMPOSE_FILE`) risks
|
||||
**drift** from the recipe users run — so **avoid where possible and justify each use**. But it is a
|
||||
**legitimate, uniform fallback pattern**, not forbidden:
|
||||
|
||||
- **Prefer an upstream recipe PR** in most cases — a real robustness fix, or exposing a knob the recipe
|
||||
should expose. That's where a fix usually belongs.
|
||||
- **A ccci overlay is the right tool when the value can't be supplied any other way** — notably a
|
||||
healthcheck **`start_period`**, which **abra cannot take from an env var**. The ghost/discourse
|
||||
`start_period` bumps therefore **stay as overlays** (an env PR is impossible for that field).
|
||||
- **Uniform pattern (acceptable fallback):** a single, fixed-name **`compose.ccci.yml`** per recipe
|
||||
(NOT per-purpose suffixes — one file holds all cc-ci-side deploy tweaks for that recipe), provided
|
||||
into the checkout by `install_steps.sh`, wired by `recipe_meta` `COMPOSE_FILE`
|
||||
(`compose.yml:compose.ccci.yml`), kept as an untracked file so it survives the upgrade
|
||||
`git checkout -f` (`CHAOS_BASE_DEPLOY=True`; `assert_upgraded` strips the `+U` marker — see
|
||||
DECISIONS 2026-05-30).
|
||||
- **Each overlay must:** be **minimal + single-purpose**, **document WHY** in its header (the exact
|
||||
abra/upstream limitation that forces it), and be **Adversary-confirmed** to not weaken a test or mask
|
||||
a recipe defect. Where the fix also belongs upstream (e.g. a `start_period` too tight for any slow
|
||||
host), **file the upstream PR too** — the overlay is the cc-ci-side fallback, not a reason to skip it.
|
||||
|
||||
## 1. Upgrade tier: always test the upgrade to LATEST
|
||||
|
||||
Don't drop the upgrade test because the *from* (older) version is awkward.
|
||||
- **Always perform the upgrade to the latest version and run the full assertions on the latest.**
|
||||
- If the older from-version can't be fully deployed/tested (image tag removed from the registry, or it
|
||||
predates an overlay/feature), you do **NOT** need that older version's **custom tests** to run.
|
||||
Deploy it minimally (a justified overlay is fine) or upgrade from the nearest deployable prior; skip
|
||||
only the from-version's custom assertions, and **record** that.
|
||||
- Skipping a from-version's custom tests = honest, recorded. Skipping upgrade-to-latest = not OK.
|
||||
|
||||
## 2. Disposition of the current overlays
|
||||
|
||||
- [ ] **RENAME the overlay files to the uniform `compose.ccci.yml`.** `tests/ghost/compose.ccci-health.yml`
|
||||
and `tests/discourse/compose.ccci-health.yml` → `compose.ccci.yml`; update each recipe's
|
||||
`install_steps.sh` (the `cp` target) and `recipe_meta` `COMPOSE_FILE`
|
||||
(`compose.yml:compose.ccci-health.yml` → `compose.yml:compose.ccci.yml`). One fixed filename per
|
||||
recipe going forward.
|
||||
- [ ] **ghost `compose.ccci.yml` (start_period 900s) — KEEP, justified.** abra can't env-param
|
||||
`start_period`; the fresh-DB migration needs the larger grace or swarm kills it → deadlock.
|
||||
Confirm the header documents this; consider an upstream PR raising ghost's `start_period` (it's a
|
||||
real slow-host fragility) — but the overlay stays regardless.
|
||||
- [ ] **discourse `compose.ccci.yml` — KEEP, justified (both parts).** (a) `start_period 1200s`
|
||||
(same reason as ghost). (b) The `bitnami/discourse:3.3.1 → bitnamilegacy/discourse:3.3.1` re-pin
|
||||
makes the from-version (0.7.0, whose `bitnami/discourse` tag Docker Hub now 404s) **deployable so
|
||||
the upgrade-to-latest test can run** — namespace-only, identical discourse version, applied to
|
||||
base+head. This is the §1 case: keep the upgrade-to-latest test; the 0.7.0 custom tests need not
|
||||
run. Document it; if a deployable prior without the re-pin exists, prefer upgrading from that.
|
||||
- [ ] **mumble `compose.host-ports.yml` (cc-ci copy for the old base) — DROP it.** Deploying mumble
|
||||
0.2.0 does NOT need host-ports (that overlay only *publishes* 64738 for on-host tests). Per §1:
|
||||
deploy 0.2.0 without it, **skip 0.2.0's voice/on-host custom tests**, then upgrade to the latest
|
||||
version (which ships `compose.host-ports.yml` natively) and run the voice tests on the latest.
|
||||
Remove the cc-ci copy + its `install_steps`/`COMPOSE_FILE` wiring for the old base; the current
|
||||
version's native overlay is untouched.
|
||||
|
||||
## 3. Definition of Done (Adversary cold-verifies)
|
||||
- [ ] Every surviving cc-ci overlay is minimal, header-documents its justification (the abra/upstream
|
||||
limitation), and is Adversary-confirmed to not weaken a test or mask a defect.
|
||||
- [ ] The mumble old-base cc-ci host-ports copy is removed; mumble still **upgrades to latest** and runs
|
||||
its voice tests **on the latest** (0.2.0's voice tests skipped + recorded).
|
||||
- [ ] ghost + discourse still pass full suites; discourse still tests the upgrade to latest.
|
||||
- [ ] Any upstream PR opened (e.g. ghost/discourse `start_period`) follows the recipe-PR rule
|
||||
(cc-ci-green via `!testme` before operator merge); the overlay remains as the cc-ci fallback.
|
||||
- [ ] No upgrade-to-latest test was dropped to avoid an awkward from-version.
|
||||
|
||||
## 4. Guardrails
|
||||
- **Correctness first** — never weaken/skip/soften a check to make a deploy or upgrade pass; an
|
||||
overlay tunes deploy/infra only (its header must say how), the real assertions stand.
|
||||
- **Justify + document every overlay**; prefer the upstream PR where the fix belongs.
|
||||
- **Real abra path** throughout.
|
||||
@@ -0,0 +1,172 @@
|
||||
# Plan: migrate cc-ci domains from `*.commoninternet.net` to `ci.autonomic.zone`
|
||||
|
||||
**Date:** 2026-09-21 · **Status:** DRAFT — blocked only on operator DNS access (Gandi zone `autonomic.zone`)
|
||||
**Principle:** same host, same IP (195.201.88.249), same services — only names change. Dual-run new
|
||||
alongside old; old names retire last; rollback at any point is "change nothing further" because the
|
||||
old DNS zone keeps answering until Phase 4.
|
||||
|
||||
---
|
||||
|
||||
## 1. Inventory — what answers on what today
|
||||
|
||||
| Name | Served by | Router/config source |
|
||||
|---|---|---|
|
||||
| `ci.commoninternet.net` | results dashboard + bridge `/hook` | `cc-ci/nix/modules/dashboard.nix`, `bridge.nix` (traefik Host rules) |
|
||||
| `report.ci.commoninternet.net` | weekly report static site | `cc-ci/nix/modules/reports.nix` |
|
||||
| `drone.ci.commoninternet.net` | Drone server | `cc-ci/nix/modules/drone.nix` (abra app; env `DOMAIN`, `DRONE_SERVER_HOST`); runner RPC: `drone-runner.nix` |
|
||||
| `oc.ci.commoninternet.net` | opencode UI (traefik → host nginx basic auth) | `cc-ci-orch/nix/modules/orchestrator-host.nix` (`opencodeUiHost`), set in `nix/hosts/cc-ci/configuration.nix` |
|
||||
| `traefik.ci.commoninternet.net` | traefik stack identity + deploy-proxy health gate | `cc-ci/nix/modules/proxy.nix` |
|
||||
| `warm-*.ci.commoninternet.net` | warm canonical recipe stacks | `warm-keycloak.nix`, warm-bluesky-pds (caddy labels) |
|
||||
| `<tag>-<6hex>.ci.commoninternet.net` | per-run recipe test deploys | `cc-ci/runner/harness/naming.py` `app_domain()` — **resolves via public DNS** (containers use 1.1.1.1/8.8.8.8) |
|
||||
| `backups.ci.commoninternet.net` | backup-bot-two — stack name only, no web route | `backupbot.nix` |
|
||||
| `acme.commoninternet.net` (NS `ns-acme`) | local acme-dns (systemd, port 53) | `cc-ci/nix/modules/acme-dns.nix` |
|
||||
|
||||
**Cert chain today:** nixos `security.acme` (lego) issues `ci.commoninternet.net` + `*.ci.commoninternet.net`
|
||||
via DNS-01 through the local acme-dns; Gandi delegates `_acme-challenge.ci.commoninternet.net` CNAME →
|
||||
`9d3f0428-eb97-4b14-bb07-da2f0f6c2073.acme.commoninternet.net`. `postRun` fires
|
||||
`cc-ci-acme-traefik-handoff.service` → installs cert into `/var/lib/ci-certs/live` → restarts
|
||||
`deploy-proxy.service`, whose reconciler re-derives the `traefik_ci_commoninternet_net_ssl_{cert,key}_v<hash>`
|
||||
swarm secrets (traefik runs co-op-cloud wildcard/no-ACME mode off those secrets).
|
||||
**DNS:** both zones on Gandi. IPv4-only (no AAAA records anywhere; none needed).
|
||||
|
||||
**External references:** Gitea OAuth app for Drone (redirect URI → drone.ci…); per-repo webhooks →
|
||||
`/hook` — **only `recipe-maintainers/ghost` and `recipe-maintainers/discourse` have any** (everything
|
||||
else is bridge-driven via the Drone API); ~60 doc references across cc-ci-orch (AGENTS.md, README,
|
||||
plan.md, skills).
|
||||
|
||||
## 2. Target naming
|
||||
|
||||
| Old | New |
|
||||
|---|---|
|
||||
| ci.commoninternet.net | ci.autonomic.zone |
|
||||
| report.ci.commoninternet.net | report.ci.autonomic.zone |
|
||||
| drone.ci.commoninternet.net | drone.ci.autonomic.zone |
|
||||
| oc.ci.commoninternet.net | oc.ci.autonomic.zone |
|
||||
| traefik.ci.commoninternet.net | traefik.ci.autonomic.zone |
|
||||
| *.ci.commoninternet.net (warm-\*, per-run apps, backups identity) | *.ci.autonomic.zone |
|
||||
| acme.commoninternet.net | **stays** through Phases 1–2 (infra, not a front door); optional Phase 3 |
|
||||
|
||||
Swarm **stack names** (`traefik_ci_commoninternet_net`, `ccci-*`, warm stacks) are identifiers, not
|
||||
domains — keep them where possible to avoid churn in keep-lists/prune filters, EXCEPT abra-managed
|
||||
apps whose name **is** the domain (drone, backup-bot, per-run apps).
|
||||
|
||||
## 3. DNS records to set (zone `autonomic.zone`, Gandi — operator)
|
||||
|
||||
| # | Name | Type | Value | TTL | Purpose |
|
||||
|---|---|---|---|---|---|
|
||||
| 1 | `ci.autonomic.zone` | A | `195.201.88.249` | 300 | apex front door (wildcard does NOT cover the apex) |
|
||||
| 2 | `*.ci.autonomic.zone` | A | `195.201.88.249` | 300 | report/drone/oc/traefik/warm-\*/`<tag>-<6hex>` run apps |
|
||||
| 3 | `_acme-challenge.ci.autonomic.zone` | CNAME | `9d3f0428-eb97-4b14-bb07-da2f0f6c2073.acme.commoninternet.net.` | 300 | DNS-01 for the new wildcard — **reuses the existing restricted acme-dns account** (`disable_registration=true`; the lego *account* authenticates, not the FQDN, so one acme-dns subdomain serves both zones) |
|
||||
|
||||
Also: lower TTL to 300 on the old `ci`/`*.ci` records a few days ahead (fast rollback later).
|
||||
Phase 3 (optional) adds: `acme.ci.autonomic.zone` + `ns-acme.ci.autonomic.zone` A records.
|
||||
|
||||
**DNS verification (before touching the host):**
|
||||
```bash
|
||||
dig +short ci.autonomic.zone A @ns-187-a.gandi.net # 195.201.88.249
|
||||
dig +short report.ci.autonomic.zone @1.1.1.1 # 195.201.88.249 (via wildcard)
|
||||
dig +short drone.ci.autonomic.zone @8.8.8.8 # 195.201.88.249
|
||||
dig +short _acme-challenge.ci.autonomic.zone CNAME # 9d3f0428-….acme.commoninternet.net.
|
||||
```
|
||||
|
||||
## 4. Phase 1a — certificate (issue BEFORE any routing change)
|
||||
|
||||
1. `cc-ci/nix/modules/acme-dns.nix`: add a second `security.acme.certs."ci.autonomic.zone"` entry
|
||||
(domain + `*.ci.autonomic.zone` SAN, `dnsProvider = "acmedns"`, `dnsResolver = "1.1.1.1:53"`).
|
||||
Split the lego env per cert — today `ACME_DNS_STORAGE_PATH` is baked to
|
||||
`/var/lib/acme/ci.commoninternet.net/…`; generate one env file per cert so each keeps its own
|
||||
acme-dns account file.
|
||||
2. Extend `cc-ci-acme-traefik-handoff` to stage the new cert alongside the old
|
||||
(`/var/lib/ci-certs/live` holds both, e.g. `fullchain.pem` = new + `fullchain-old.pem`).
|
||||
3. Extend the **deploy-proxy reconciler** (`proxy.nix`) for **dual-cert SNI**: new wildcard pair as
|
||||
`ssl_cert/ssl_key` (default store) + old pair as a second secret pair wired through a small
|
||||
file-provider `[[tls.certificates]]` so `*.ci.commoninternet.net` keeps serving during the bake
|
||||
window. This is the one fiddly bit — validate against the **Let's Encrypt staging** endpoint
|
||||
first (the module already has the staging-marker pattern).
|
||||
4. `nixos-rebuild test` → confirm both certs issued and served (`openssl s_client -servername` for a
|
||||
name in each zone, check SANs) → `switch`.
|
||||
|
||||
## 5. Phase 1b — routing + service config (one stack at a time, health-gated)
|
||||
|
||||
During the bake window every router rule carries **both** hostnames
|
||||
(`Host(`ci.autonomic.zone`) || Host(`ci.commoninternet.net`)`); old names drop out only in Phase 4.
|
||||
|
||||
- `dashboard.nix` + `bridge.nix` (share the `ci` host: dashboard `/` + bridge `/hook`), `reports.nix`,
|
||||
and the traefik health-gate name in `proxy.nix`.
|
||||
- `bridge.py` / `dashboard.py` code defaults for `DRONE_URL` / `DASH_URL`.
|
||||
- `recipe-report.py` — footer, publish URL text and its verification curl → `report.ci.autonomic.zone`
|
||||
(regenerate the index after, so the home page stops linking the old name).
|
||||
- Drone **abra app rename** (name = domain, so this is a new stack):
|
||||
1. Export enabled-repo list from the old Drone API.
|
||||
2. Deploy new abra app `drone.ci.autonomic.zone` (same module; secrets `rpc_secret`,
|
||||
`client_secret` re-insert from `/run/secrets` as today). **Fresh DB** — Drone data volume is
|
||||
stack-name-prefixed; repos re-sync on Gitea login, build history is lost (accepted; export the
|
||||
old repo list and re-enable via API).
|
||||
3. Point `drone-runner.nix` `DRONE_RPC_HOST` at the new name; restart runner.
|
||||
4. Re-run `scripts/bootstrap-drone-oauth.sh` with `DRONE=https://drone.ci.autonomic.zone`
|
||||
(updates the Gitea OAuth redirect URI; script already uses `--resolve` to hit loopback).
|
||||
5. Update the two webhooks (ghost, discourse) to `https://drone.ci.autonomic.zone/hook?secret=<same>`
|
||||
— read the secret off the existing hook config before deleting it.
|
||||
6. `abra app undeploy` + remove the old drone app once green.
|
||||
- `configuration.nix`: `opencodeUiHost = "oc.ci.autonomic.zone"`; extend the `networking.hosts`
|
||||
self-pin list with the new names (keep old pins during bake).
|
||||
- Gitea `GITEA_SERVER` stays `git.autonomic.zone` — unchanged.
|
||||
|
||||
## 6. Phase 2 — harness / warm / per-run naming (the `_ci_commoninternet_net` blast radius)
|
||||
|
||||
- `cc-ci/runner/harness/naming.py` `app_domain()` → `.ci.autonomic.zone` (single source of truth).
|
||||
- Regexes/patterns that match the derived names: `docker-prune.nix` run-app filter,
|
||||
`tests/concurrency/concutil.py` (`DOMAIN` const + `RUN_APP_RE`), any separate `RUN_APP_RE` in
|
||||
`lifecycle.py` / `warm.py` / `warm_reconcile.py` / `canonical.py` / `generic.py` / `http.py`,
|
||||
`nightly-sweep` keep-list patterns, `tests/gitea/recipe_meta.py` comment.
|
||||
- Redeploy warm stacks under new names (abra `warm-<recipe>.ci.autonomic.zone`), reconcile, drain old.
|
||||
- `backupbot.nix` `DOMAIN` (stack-name-only change).
|
||||
- Verify: full deterministic test suite + one live `!testme` run end-to-end.
|
||||
|
||||
## 7. Phase 3 (optional) — move acme-dns off commoninternet.net
|
||||
|
||||
Only if `commoninternet.net` is being dropped entirely: new `domain`/`nsname` in acme-dns config
|
||||
(`acme.ci.autonomic.zone` / `ns-acme.ci.autonomic.zone` + Gandi records), briefly re-enable
|
||||
registration or hand-migrate the account DB, re-point `_acme-challenge` CNAMEs, re-issue both certs.
|
||||
|
||||
## 8. Phase 4 — retirement (after ≥7 clean days)
|
||||
|
||||
Remove old names from the dual router rules → remove `security.acme.certs."ci.commoninternet.net"`
|
||||
+ its env file + old cert secret pair → drop old `networking.hosts` pins → delete old Gandi records
|
||||
(`ci`, `*.ci`, `_acme-challenge.ci`) → restore TTLs to 3600. Keep `acme.commoninternet.net` unless
|
||||
Phase 3 was done.
|
||||
|
||||
## 9. Verification checklist
|
||||
|
||||
- **DNS:** the dig table in §3 against a Gandi NS and a public resolver.
|
||||
- **Cert:** `openssl s_client -connect 195.201.88.249:443 -servername <name>` for one name per zone —
|
||||
SANs correct for both, `ssl_verify_result=0`.
|
||||
- **Front doors:** `ci` → 200 · `report.ci` → 200 · `drone.ci` → 200/303 · `oc.ci` → **401**
|
||||
(basic auth intact) · `traefik.ci/api/version` → 200.
|
||||
- **SSO:** Drone login through Gitea on the new redirect URI.
|
||||
- **Webhook:** empty commit to `recipe-maintainers/ghost` main → build fires on the new host.
|
||||
- **Bridge/!testme:** `!testme` on a scratch PR → build runs, `results.json` written, PR comment
|
||||
contains **new** domain links.
|
||||
- **Report:** publish one report page and verify it at `https://report.ci.autonomic.zone`.
|
||||
- **Host:** `systemctl --failed` empty; `deploy-proxy` reconcile logs clean.
|
||||
|
||||
## 10. Risks / gotchas
|
||||
|
||||
- **Dual-cert SNI in the traefik reconciler** is the highest-risk change — stage-first, verify SNI
|
||||
selection for both zones before switching.
|
||||
- **Drone DB** does not follow the abra rename — accept fresh build history; export/re-apply the
|
||||
enabled-repo list; re-insert secrets from `/run/secrets` (module already does).
|
||||
- **Per-run recipe domains resolve via public DNS** — the `*.ci.autonomic.zone` wildcard A record is
|
||||
load-bearing for every test deploy; never merge Phase 2 before it propagates.
|
||||
- Old PR comments/badges link old names — they keep working until Phase 4 removes the old records.
|
||||
- ~60 doc references (AGENTS.md, README, plan.md, skills, status skill) — one cosmetic doc PR at the
|
||||
end so the docs don't lie.
|
||||
- No domain-bearing secret values were found (webhook secrets are per-repo and copied as-is).
|
||||
|
||||
## 11. Sequencing
|
||||
|
||||
1. **Operator:** TTLs down + 3 Gandi records (§3) — 5 minutes.
|
||||
2. **Agent:** cert PR (§4) → `test` → verify dual SNI → `switch`.
|
||||
3. **Agent:** routing/env PRs (§5) stack-by-stack, health-gated; OAuth + webhooks + drone rename.
|
||||
4. **Agent:** end-to-end verification (§9) + report republish under the new name.
|
||||
5. **Bake ≥7 days** → Phase 2 PR → full suite → bake → Phase 4 retirement.
|
||||
@@ -0,0 +1,54 @@
|
||||
# Plan — debug & fix the ghost recipe upgrade PR
|
||||
|
||||
**Context:** during the 2026-06-12 weekly upgrade, ghost (ghost 6.42.0→6.44.1 + mysql bump) was the
|
||||
recipe whose `!testme` kept wedging. Its test deploys (`ghos-bdd2f3` etc.) hung at 0/1 in Swarm
|
||||
`New` state — which we now know was the **`proxy` VIP exhaustion** (see
|
||||
[[proxy-vip-exhaustion-runbook]] / `plan-proxy-vip-exhaustion-fix.md`), NOT necessarily a ghost
|
||||
defect. It also got run by a DUPLICATE subagent during the interrupt churn, so the PR/branch state
|
||||
may be messy. This plan figures out what actually went wrong and leaves the ghost PR clean + green.
|
||||
|
||||
**Execute AFTER** the proxy VIP fix (so the infra confound is gone) and the current upgrade settles.
|
||||
Owner: orchestrator, or a focused `/recipe-upgrade ghost` re-run.
|
||||
|
||||
## What the upgrader already found (2026-06-12 summary — start here)
|
||||
ghost 6.42.0→6.44.1 (+ mysql 8.0→8.4). PR is **recipe-maintainers/ghost #4**, open with an analysis
|
||||
comment. Three `!testme` attempts:
|
||||
- run 1 (2026-06-05): **PASS** at 6.44.0 + mysql:8.4 (under lighter load).
|
||||
- run 2 (2026-06-12): FAIL — **IPAM/proxy-VIP exhaustion** (infra; the [[proxy-vip-exhaustion-runbook]] issue).
|
||||
- run 3 (2026-06-12): FAIL — **a REAL issue**: Swarm `UpdateStatus=paused` on the **mysql 8.0→8.4
|
||||
data-dir upgrade race** — the default 5s `update_config.monitor` is too tight for the mysql
|
||||
data-dir migration under load, so Swarm marks the update paused/failed.
|
||||
The upgrader's suggested fix: add **`update_config.monitor: 300s`** (and likely
|
||||
`failure_action: continue` / a longer `start_period`) to the ghost **app** service so the mysql
|
||||
data-dir upgrade has time to converge. So the likely real fix is a small recipe-PR change to ghost's
|
||||
`update_config`, then re-verify — NOT a test change.
|
||||
|
||||
## Steps
|
||||
1. **Inventory the ghost PR state.** On recipe-maintainers/ghost: list open PRs — is there ONE
|
||||
upgrade PR or a DUPLICATE (two branches/PRs from the two ghost subagents)? Capture each PR's
|
||||
branch, diff (image tag + version-label bumps), and its `!testme` comment history / build
|
||||
results. Read the upgrader transcript for both ghost subagents to see what each did.
|
||||
2. **Separate infra failure from real failure.** The deploy wedges were proxy-VIP exhaustion
|
||||
(infra). Determine whether ghost ALSO has a genuine upgrade problem: does ghost 6.44.1 + the
|
||||
mysql bump deploy + pass its tests on a HEALTHY swarm? Re-run `!testme` on the ghost PR now that
|
||||
the box is healthy (post docker-restart / post proxy fix) and watch the real result.
|
||||
3. **Dedup.** If two ghost PRs/branches exist, keep the correct one (right version bump, clean
|
||||
diff), close the duplicate with a note, and ensure no leftover `dev-ghost`/`ghos-*` stacks remain
|
||||
(reap).
|
||||
4. **Fix forward to green.** If `!testme` is RED for a REAL reason (e.g. ghost 6.44.1 needs a config
|
||||
change, or the mysql major bump needs a migration step / a genuinely-stale test): apply the
|
||||
minimal recipe fix per `/recipe-upgrade` rules — recipe PR changes only; if a cc-ci TEST is
|
||||
genuinely stale, leave an explanatory PR COMMENT (do NOT edit tests in default mode). Iterate
|
||||
`!testme` ≤3× to green.
|
||||
5. **Leave it operator-ready.** One clean ghost PR, `!testme` GREEN (or a clear comment explaining a
|
||||
legitimately-deferred issue), no duplicate, no leaked deploys. NEVER merge — operator merges.
|
||||
|
||||
## Acceptance
|
||||
The ghost upgrade is represented by exactly one PR with a clear, green (or clearly-explained)
|
||||
`!testme`, the duplicate-subagent mess cleaned, and a one-line note on whether ghost's original
|
||||
failure was purely the proxy-VIP infra issue or a real upgrade problem (and how it was fixed).
|
||||
|
||||
## Guardrails
|
||||
Recipe mirror = PR only, never merge / never push main. Reap any `dev-ghost`/`ghos-*` test stacks on
|
||||
exit. No secrets in logs/commits. Don't run while the proxy recreate (maintenance window) is in
|
||||
progress.
|
||||
@@ -0,0 +1,97 @@
|
||||
# Plan — lasuite-drive OIDC-setup flakiness: harness restructure + recipe robustness PR
|
||||
|
||||
**Status:** QUEUED — picks up the deferred lasuite-drive `[~]` item (Q3.2) when the loops return to it.
|
||||
The disk blocker is now lifted (host grew to 70 GB, 2026-05-29), so the upgrade tier can run too.
|
||||
**Owner:** Builder + Adversary loops. **Two deliverables:** (A) a cc-ci harness change, (B) a
|
||||
**lasuite-drive recipe PR** (we maintain the recipe via recipe-maintainer).
|
||||
**This file:** `/srv/cc-ci/cc-ci-plan/plan-lasuite-drive-oidc-robustness.md`
|
||||
|
||||
---
|
||||
|
||||
## 0. The problem (ground it in real logs FIRST)
|
||||
|
||||
lasuite-drive's `setup_custom_tests` wires OIDC by doing a **full 12-service `abra app deploy --chaos`
|
||||
redeploy** of an already-running heavy stack. That reconverge is **flaky**: a collabora reconverge
|
||||
race + a **transient backend gunicorn-perms / WOPI-404 window**. Only **backend/app** consume the
|
||||
OIDC env, so re-converging collabora/onlyoffice/minio/db is unnecessary exposure. The Builder
|
||||
correctly did NOT claim Q3.2 (a flaky setup isn't a reliable green) and filed this.
|
||||
|
||||
**Step 0 (do before fixing):** capture the actual failure from a flaky run — collabora WOPI-discovery
|
||||
timing, the backend log at the 404, and the exact gunicorn perms error — so we fix the real root
|
||||
cause, not a guess. Record in JOURNAL.
|
||||
|
||||
---
|
||||
|
||||
## Part A — cc-ci harness: wire OIDC at INSTALL, eliminate the redeploy
|
||||
|
||||
Leverage the now **live-warm keycloak** (WC1): instead of deploy-recipe-then-redeploy-with-OIDC, the
|
||||
dep is already running, so configure OIDC **before the single deploy**:
|
||||
|
||||
1. Create the per-run namespaced realm+client in the **warm keycloak** (lightweight API calls — no
|
||||
deploy).
|
||||
2. Set lasuite-drive's OIDC env in its `.env` **before** the first `abra app deploy`.
|
||||
3. Deploy lasuite-drive **once**, OIDC already wired. **No mid-run `--chaos` reconverge** → the flaky
|
||||
window is gone.
|
||||
|
||||
- **Use REAL abra commands only** (operator decision, 2026-05-29): the install is a normal
|
||||
`abra app deploy`. Do **NOT** use `docker service update`/`docker service scale` to surgically
|
||||
patch services — CI must exercise the same abra path a real operator uses. If any redeploy ever
|
||||
remains necessary, it is `abra app deploy` (+ proper readiness gating, §C), never a docker-level
|
||||
bypass.
|
||||
- **Generic-first invariant still holds.** keycloak is live-warm (persistent infra, ~always up), so
|
||||
there's no per-run dep *deploy* that could fail and break a generic tier. Generic tiers still
|
||||
assert serving recipe-alone; if realm creation or the provider is unreachable, only the OIDC
|
||||
*custom* test fails (isolated). This is SAFE **iff** the recipe boots with OIDC-env-set even when
|
||||
the provider isn't reachable at boot — which Part B guarantees (lazy OIDC). A and B reinforce each
|
||||
other.
|
||||
- **Revises `plan-sso-dep-testing.md`** for recipes whose app tolerates OIDC-at-boot: prefer
|
||||
install-time wiring against the warm dep over the post-deploy `setup_custom_tests` redeploy. Keep
|
||||
the redeploy path only for recipes that genuinely can't take OIDC env at first boot.
|
||||
- **Verify:** lasuite-drive full suite green **without** a mid-run reconverge; run it repeatedly
|
||||
(e.g. 3×) to show the flakiness is gone, not just absent once.
|
||||
|
||||
## Part B — lasuite-drive recipe PR (root-cause robustness, we're maintainers)
|
||||
|
||||
> **Broken out into its own sub-plan: `plan-lasuite-drive-recipe-pr.md`** (operator, 2026-05-29) —
|
||||
> it now also folds in the F2-12 upgrade-convergence fix (collabora healthcheck) so cc-ci can return
|
||||
> to abra-native convergence. The summary below is retained; the sub-plan is authoritative.
|
||||
|
||||
Fix the fragility in the recipe itself so it's robust under ANY reconverge — this helps real
|
||||
operators, not just CI, and is the real payoff of maintaining the recipe. On a branch of the
|
||||
lasuite-drive recipe (recipe-maintainer):
|
||||
|
||||
1. **Order backend behind collabora's WOPI readiness.** Add a Docker **healthcheck on collabora**
|
||||
(WOPI discovery endpoint → 200) and make backend **wait for it / retry WOPI discovery with
|
||||
backoff** instead of failing during collabora startup. Turns the race into deterministic ordering.
|
||||
2. **Fix the gunicorn-perms race.** The transient perms error is a volume-permission race at startup
|
||||
(gunicorn can't read/write a mount until perms are set). Fix in the entrypoint: set perms before
|
||||
exec'ing gunicorn (or a proper init step).
|
||||
3. **Make OIDC discovery lazy / retrying.** If backend validates the OIDC provider eagerly at boot
|
||||
and dies when it's briefly unreachable, that's what forces the deploy-with-dep dance. Resolve OIDC
|
||||
discovery lazily (at first login, with retry) so the app boots without the provider up. (This is
|
||||
also the property Part A relies on for the generic-first invariant.)
|
||||
|
||||
### The PR is "working" ONLY when cc-ci verifies it green (operator rule, 2026-05-29)
|
||||
A lasuite-drive recipe change is **not** considered done until **our CI server has run the full suite
|
||||
on the PR and it passes** — install + upgrade + backup + restore + custom (incl. the OIDC login
|
||||
test), repeatedly-green (no flakiness). Concretely: push the recipe branch/PR, trigger cc-ci
|
||||
(`!testme` on the lasuite-drive PR), and require a clean green (Adversary cold-verified). **Only then
|
||||
does the operator merge** the recipe PR. This dogfoods cc-ci: the CI that surfaced the bug also gates
|
||||
its fix.
|
||||
|
||||
## C. If any redeploy must remain (fallback only)
|
||||
If a recipe genuinely needs OIDC env applied after first boot, do it with **`abra app deploy`** (real
|
||||
abra — never `docker service update`), and **gate readiness properly**: poll collabora WOPI = 200 +
|
||||
backend health with retries/timeout before declaring ready. This is strictly a fallback; Part A +
|
||||
Part B should remove the need.
|
||||
|
||||
## Definition of done
|
||||
- [ ] Step 0 root-cause logs captured + recorded.
|
||||
- [ ] Part A: lasuite-drive tested via install-time OIDC wiring against the warm keycloak, **no
|
||||
mid-run reconverge**, full suite green **3× in a row** (flakiness gone), Adversary cold-verified.
|
||||
- [ ] Part B: lasuite-drive recipe branch with the WOPI-healthcheck-gating + gunicorn-perms + lazy-OIDC
|
||||
fixes; **cc-ci runs the full suite (incl. upgrade tier) on the PR and it is repeatedly green**;
|
||||
Adversary cold-verifies; operator merges.
|
||||
- [ ] Q3.2 (lasuite-drive) claimed + DEFERRED.md entry closed (flaky-OIDC item) — only after the above.
|
||||
- [ ] `plan-sso-dep-testing.md` updated to prefer install-time OIDC wiring (warm dep) where the recipe
|
||||
supports it.
|
||||
@@ -0,0 +1,77 @@
|
||||
# Sub-plan — lasuite-drive recipe robustness PR (fix the root cause upstream)
|
||||
|
||||
**Status:** QUEUED — a **recipe-maintainer PR to the lasuite-drive recipe** (we maintain it). Picks up
|
||||
after the Q3.2 lasuite-drive test work settles. Complements — and largely **obsoletes** — the
|
||||
CI-side workarounds the harness currently uses for lasuite-drive's fragility.
|
||||
**Owner:** Builder + Adversary loops. **This file:** `/srv/cc-ci/cc-ci-plan/plan-lasuite-drive-recipe-pr.md`
|
||||
**Relationship:** this is the **recipe-side** deliverable. The cc-ci **harness-side** OIDC-at-install
|
||||
work is `plan-lasuite-drive-oidc-robustness.md` Part A; this sub-plan is its Part B, broken out.
|
||||
|
||||
---
|
||||
|
||||
## 0. Why (CI surfaced real recipe bugs — fix them at the source)
|
||||
|
||||
cc-ci has surfaced genuine fragility in the lasuite-drive recipe that a **real operator would also
|
||||
hit**, currently papered over by CI-side workarounds:
|
||||
- **Install-time:** backend comes up before collabora's WOPI discovery is ready → transient
|
||||
**WOPI-404** + a **gunicorn-perms** startup race. The flaky 12-service `--chaos` OIDC redeploy.
|
||||
- **Upgrade-time (F2-12):** upgrading to the heavier new collabora (25.04.9.4.1) **does not converge
|
||||
within abra's monitor window** → abra FATAs. The harness currently works around this by skipping
|
||||
abra's convergence monitor (`-c`) and using its own collabora WOPI-200 `READY_PROBE`.
|
||||
|
||||
These are recipe defects. Fixing them upstream helps every lasuite-drive operator **and** lets cc-ci
|
||||
**go back to abra's native convergence** (per the guardrail "prefer abra convergence; custom probe
|
||||
only when necessary") — turning the harness `-c`/READY_PROBE from a *necessity* into a *backstop*.
|
||||
|
||||
## 1. The fixes (lasuite-drive recipe)
|
||||
|
||||
1. **Collabora healthcheck + start_period (the keystone).** Add a real Docker **healthcheck** to the
|
||||
collabora service — WOPI discovery endpoint returns 200 — with a `start_period` generous enough
|
||||
for the heavy 25.04 image to boot. Effect: (a) swarm/abra see collabora as *unhealthy until WOPI
|
||||
is actually up*, so **abra's own convergence monitor waits correctly** (fixes F2-12 at the source
|
||||
— no `-c` skip needed); (b) the install-time WOPI-404 window closes because dependents can gate on
|
||||
collabora health.
|
||||
2. **Backend tolerates / waits for collabora WOPI.** Make backend **retry WOPI discovery with
|
||||
backoff** (and/or order it behind collabora health) instead of failing on the transient 404.
|
||||
3. **Fix the gunicorn-perms startup race.** Set the volume permissions in the backend entrypoint
|
||||
(or an init step) **before** exec'ing gunicorn, so there's no read/write race on a freshly-mounted
|
||||
volume at startup.
|
||||
4. **Lazy / retrying OIDC discovery.** Backend resolves the OIDC provider **at first login with
|
||||
retry**, not eagerly at boot — so the app boots cleanly with OIDC env set even if the provider
|
||||
isn't reachable yet. (This is also what the harness-side OIDC-at-install pattern relies on, and
|
||||
what keeps the generic-first invariant safe.)
|
||||
|
||||
## 2. Mechanics — branch, PR, and the merge rule
|
||||
|
||||
- Make the change on a **lasuite-drive recipe branch** and open a PR via the **`recipe-create-pr`
|
||||
skill** (`/srv/recipe-maintainer/.opencode/skills/recipe-create-pr/SKILL.md`) — mirror to
|
||||
`git.autonomic.zone/recipe-maintainers/lasuite-drive` as needed; upstream is
|
||||
`git.coopcloud.tech`.
|
||||
- **The PR is "working" ONLY when cc-ci verifies it green** (operator rule): trigger cc-ci
|
||||
(`!testme` on the lasuite-drive PR) and require the **full suite incl. the UPGRADE tier** to pass
|
||||
**repeatedly-green** (e.g. 3 consecutive passes, not a one-off), **Adversary cold-verified**.
|
||||
**Only then does the operator merge.** This dogfoods cc-ci: the CI that found the bugs gates the fix.
|
||||
- **SCOPE (operator, 2026-05-29):** this repeated-green / 3× bar is **specific to lasuite-drive
|
||||
because it was demonstrably FLAKY** — it's a *flakiness proof* (show the fix made it reliably
|
||||
green, not green-by-luck-once). It is **NOT the general testing standard.** Normal recipe gates
|
||||
remain **one Adversary cold-verified green** (`plan.md §6.1`); do not generalize 3× to other
|
||||
recipes/gates.
|
||||
|
||||
## 3. Definition of done
|
||||
- [ ] Recipe branch with fixes #1–#4; PR opened (recipe-create-pr).
|
||||
- [ ] **cc-ci runs the full suite (install + upgrade + backup + restore + custom/OIDC) on the PR,
|
||||
repeatedly green, Adversary cold-verified.**
|
||||
- [ ] **Root-cause proof:** with the collabora healthcheck in place, demonstrate the upgrade tier
|
||||
passes under **abra's NATIVE convergence** (i.e. drop `-c` for lasuite-drive and it still
|
||||
converges + stays green) — confirming the recipe fix resolved F2-12 at the source. If it still
|
||||
needs the harness backstop, say so honestly (record why).
|
||||
- [ ] Operator merges the recipe PR. Then: cc-ci can **revert the lasuite-drive `-c`/READY_PROBE
|
||||
workaround to abra-native convergence** (per the guardrail), and close the lasuite-drive flaky
|
||||
items.
|
||||
|
||||
## 4. Guardrails
|
||||
- **Don't weaken any test** to make the PR pass — the fixes must make the recipe genuinely robust,
|
||||
proven by repeated-green cc-ci runs, not by loosening assertions.
|
||||
- **Real abra path** throughout (no docker-level bypass).
|
||||
- **Bounded** — the four targeted robustness fixes; not a recipe rewrite. Bigger recipe improvements
|
||||
→ upstream issues / IDEAS, not this PR.
|
||||
@@ -0,0 +1,210 @@
|
||||
# SSO-dep testing pattern (OIDC + co-deployed provider) — reference plan
|
||||
|
||||
**Status:** active reference for Phase 2 (does not need its own phase; it's a pattern Phase 2
|
||||
overlays apply per recipe).
|
||||
**Operator clarification (2026-05-28):** integrating a recipe with an OIDC/SSO dep is **loop work,
|
||||
not operator work**. Anything that was deferred citing "operator input needed for OIDC" should be
|
||||
re-opened and done autonomously per this plan.
|
||||
**This file's path:** `/srv/cc-ci/cc-ci-plan/plan-sso-dep-testing.md`
|
||||
**Companion:** the running harness in `runner/harness/sso.py` (existing primitives:
|
||||
`setup_keycloak_realm`, `oidc_password_grant`, `assert_discovery_endpoint`).
|
||||
|
||||
---
|
||||
|
||||
## 0. Why this plan
|
||||
|
||||
Several recipes test their authenticated functionality through an OIDC/SSO provider (keycloak,
|
||||
authentik). The cc-ci pattern is to **co-deploy the provider with the recipe under test in the same
|
||||
ephemeral run** — one shared deployment per dep, configured at install time, used by the
|
||||
recipe-under-test's authenticated tests, torn down with it. This file is the canonical pattern for
|
||||
how to wire that up so any recipe that declares `DEPS = ["keycloak"]` (or `["authentik"]`) Just Works
|
||||
without per-recipe ad-hoc plumbing. Recipes that need OIDC are not blocked on the operator — they
|
||||
follow this plan.
|
||||
|
||||
## 1. The DEPS model — deps deploy AFTER generic tiers (operator-2026-05-28)
|
||||
|
||||
**Critical ordering rule:** generic tiers (install / upgrade / backup / restore) run against the
|
||||
**recipe alone, with no dep available**, so a failure in dep-deploy or OIDC setup **cannot break
|
||||
generic-tier signal**. Deps + OIDC wiring move to a **`setup_custom_tests` step** that runs *after*
|
||||
generic tiers and *before* the custom tier — its failure is isolated to the SSO-marked custom tests.
|
||||
|
||||
A recipe's `tests/<recipe>/recipe_meta.py` declares its SSO dep:
|
||||
```python
|
||||
DEPS = ["keycloak"] # or ["authentik"] when that backend lands
|
||||
```
|
||||
|
||||
### Lifecycle order (single run, per recipe)
|
||||
|
||||
```
|
||||
1. Deploy recipe-under-test ALONE (no deps, OIDC env unset or stubbed).
|
||||
- app_new #1 for the recipe; generic install_steps.sh runs RECIPE-ONLY setup (no deps).
|
||||
2. INSTALL tier: generic [+ overlay] assertions against the recipe alone.
|
||||
3. UPGRADE tier: abra app upgrade in place, assertions against the recipe alone.
|
||||
4. BACKUP tier: in place (if backup-capable), recipe-alone marker.
|
||||
5. RESTORE tier: in place, recipe-alone marker.
|
||||
6. setup_custom_tests step ← NEW (operator-2026-05-28)
|
||||
a. For each dep in DEPS, deploy + provision realm/client via harness.sso.setup_<provider>_realm.
|
||||
b. Write $CCCI_DEPS_FILE with each dep's {domain, realm, client_id, client_secret, admin_*}.
|
||||
c. Run the per-recipe post-deps hook `tests/<recipe>/setup_custom_tests.sh` to wire the OIDC
|
||||
env into the running recipe (abra app config set + abra app secret insert) and trigger an
|
||||
in-place redeploy of the affected services so the env takes effect.
|
||||
d. Mark deps-ready = True on success; on ANY failure mark deps-ready = False and CONTINUE
|
||||
(log the error; do NOT abort the run).
|
||||
7. CUSTOM tier:
|
||||
- If deps-ready: run all custom tests, including those tagged @pytest.mark.requires_deps.
|
||||
- If NOT deps-ready: still run custom tests, but tests tagged @pytest.mark.requires_deps are
|
||||
reported as ERROR/SKIP (with the captured setup_custom_tests error attached). Non-deps
|
||||
custom tests still run normally.
|
||||
8. Teardown (in finally): recipe first; then each dep in reverse declaration order.
|
||||
```
|
||||
|
||||
### DG4.1 deploy-count guard, generalised
|
||||
The "one deploy per run" guard becomes **one `abra app new` per app in the run** (recipe + each
|
||||
dep). In-place reconfigure-and-redeploy (the step 6c env update) is **NOT** a fresh `app_new` and
|
||||
does NOT increment the per-recipe count. So a run with `DEPS = ["keycloak"]` has exactly 2
|
||||
`app_new` calls (recipe + keycloak), no matter how many tiers ran. The per-run summary reports
|
||||
deploy-count per app for verification.
|
||||
|
||||
### Why this ordering
|
||||
- **Generic-tier signal is preserved** when SSO/dep setup is broken — the recipe's own deploy/
|
||||
upgrade/backup/restore behaviour is still tested honestly.
|
||||
- **Failure isolation**: a recipe whose generic tier passes but whose SSO setup is broken yields
|
||||
per-op `pass/pass/pass/pass/skip(deps-not-ready)` — far more useful than the previous
|
||||
all-or-nothing.
|
||||
- A recipe that genuinely can't boot without OIDC fails its generic install honestly (the recipe
|
||||
should accept a stubbed/empty OIDC env at install time and only require the env when an
|
||||
authenticated endpoint is hit). That's a real recipe finding, not a CI artifact.
|
||||
|
||||
## 2. Provider pluggability
|
||||
|
||||
- **Provider-agnostic primitives** (today, in `harness/sso.py`) — these stay pluggable:
|
||||
- `oidc_password_grant(discovery_url, client_id, client_secret, username, password) -> token` —
|
||||
pure OIDC; works against any compliant provider.
|
||||
- `assert_discovery_endpoint(discovery_url, expected_issuer)` — pure OIDC.
|
||||
- **Provider-specific setup** (admin API calls) — one function per provider:
|
||||
- `setup_keycloak_realm(domain, admin_user, admin_password, realm, client_id, redirect_uris) ->
|
||||
{client_secret, discovery_url}` — exists today.
|
||||
- `setup_authentik_realm(...)` — same shape, authentik admin API; **deferred** to a future Q4
|
||||
enrollment that actually wants authentik (see `machine-docs/DEFERRED.md`). Pluggable: a recipe
|
||||
declaring `DEPS = ["authentik"]` would just call this instead. No change to the per-recipe
|
||||
`install_steps.sh` shape beyond which provider it asks for from `$CCCI_DEPS_FILE`.
|
||||
- **Don't write per-recipe SSO logic.** All recipes use the same DEPS+install_steps shape.
|
||||
|
||||
## 3. Per-recipe hooks — two distinct scripts (recipe-only vs post-deps)
|
||||
|
||||
A recipe with `DEPS = ["keycloak"]` ships **two** optional hook scripts (either may be absent if
|
||||
not needed):
|
||||
|
||||
### 3.1 `tests/<recipe>/install_steps.sh` — RECIPE-ONLY setup, runs at install time
|
||||
This is the Phase-1d custom-install-steps hook. It runs **before** the recipe deploys, **with no
|
||||
dep available** (the dep hasn't been deployed yet at this point). Use it only for recipe-only
|
||||
setup that the recipe needs to boot at all (e.g. seed a fixture, set a non-OIDC env). **Do NOT
|
||||
read `$CCCI_DEPS_FILE` here** — it doesn't exist yet. If the recipe requires OIDC to *boot at
|
||||
all*, set a safe stub here (e.g. disable auth) so the recipe can come up for generic tiers; the
|
||||
real OIDC wiring happens in §3.2.
|
||||
|
||||
### 3.2 `tests/<recipe>/setup_custom_tests.sh` — POST-DEPS wiring, runs after generic tiers
|
||||
This is the new (operator-2026-05-28) hook that wires the recipe to its already-deployed dep,
|
||||
*after* the generic tiers have run. The orchestrator has already deployed each dep and written
|
||||
`$CCCI_DEPS_FILE` by the time this runs. Roughly:
|
||||
|
||||
```sh
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
# Read the dep's connection info from $CCCI_DEPS_FILE (orchestrator-written).
|
||||
KC_DOMAIN=$(jq -r '.keycloak.domain' "$CCCI_DEPS_FILE")
|
||||
KC_CLIENT=$(jq -r '.keycloak.client_id' "$CCCI_DEPS_FILE")
|
||||
KC_SECRET=$(jq -r '.keycloak.client_secret' "$CCCI_DEPS_FILE")
|
||||
KC_REALM=$( jq -r '.keycloak.realm' "$CCCI_DEPS_FILE")
|
||||
|
||||
# Inject the OIDC client secret as an abra app secret (recipe-conventional name varies — match
|
||||
# the recipe's .env.sample SECRET_*).
|
||||
echo "$KC_SECRET" | abra app secret insert -n "$CCCI_APP_DOMAIN" oidc_rpcs v1 -
|
||||
|
||||
# Write the OIDC env vars to the parent .env (names per the recipe's .env.sample).
|
||||
abra app config set "$CCCI_APP_DOMAIN" \
|
||||
OIDC_REALM="$KC_REALM" \
|
||||
OIDC_OP_DISCOVERY_ENDPOINT="https://${KC_DOMAIN}/realms/${KC_REALM}/.well-known/openid-configuration" \
|
||||
OIDC_OP_AUTHORIZATION_URL="https://${KC_DOMAIN}/realms/${KC_REALM}/protocol/openid-connect/auth" \
|
||||
OIDC_OP_TOKEN_URL="https://${KC_DOMAIN}/realms/${KC_REALM}/protocol/openid-connect/token" \
|
||||
OIDC_OP_USER_URL="https://${KC_DOMAIN}/realms/${KC_REALM}/protocol/openid-connect/userinfo" \
|
||||
OIDC_RP_CLIENT_ID="$KC_CLIENT" \
|
||||
OIDC_RP_REDIRECT_URI="https://${CCCI_APP_DOMAIN}/auth/oidc/callback"
|
||||
|
||||
# Force an in-place redeploy of the affected services to pick up the new env. This is NOT a fresh
|
||||
# app_new (deploy-count guard still 1 for this recipe).
|
||||
abra app deploy --force --chaos --no-input "$CCCI_APP_DOMAIN"
|
||||
```
|
||||
|
||||
The OIDC env-var **names are recipe-specific** (`OIDC_OP_*` for lasuite-docs, different prefixes
|
||||
elsewhere). Read the recipe's `.env.sample` to see which keys the recipe expects; the *values* follow
|
||||
this template. If a recipe needs more than this (extra group/claim mappings, etc.), extend its
|
||||
`setup_custom_tests.sh` only — never the shared harness.
|
||||
|
||||
## 4. Test pattern: authenticated endpoints (mark + isolate)
|
||||
|
||||
- **Mark dep-requiring tests:** every custom test that needs the dep up + OIDC wired must use
|
||||
`@pytest.mark.requires_deps`. The orchestrator skips these with reason `"deps-not-ready: <err>"`
|
||||
if `setup_custom_tests` failed. Non-deps custom tests are unaffected by SSO setup failures.
|
||||
- **Headless API tests** — use `harness.sso.oidc_password_grant` to mint an access token, then call
|
||||
the recipe's authenticated endpoint with `Authorization: Bearer <token>`. Asserts on the response.
|
||||
- **Browser flows (Playwright)** — navigate to the recipe, follow the redirect to keycloak, fill the
|
||||
pre-provisioned test user's credentials, return to the recipe, exercise the UI. (Use the
|
||||
pre-provisioned `ci-user@example.com` / known password the realm setup creates.)
|
||||
- **The realm/client is fresh per run** — no cross-run state, no shared accounts. The realm setup
|
||||
creates one or more test users with known passwords (pass-through from a per-run secret) so the
|
||||
tests can authenticate without prompts.
|
||||
|
||||
## 5. Concrete recipes that use this pattern (Phase-2 scope)
|
||||
|
||||
These are **loop work** under this plan, not deferred:
|
||||
|
||||
- **lasuite-docs** — `DEPS = ["keycloak"]`; ports the upstream `oidc_login.py` +
|
||||
`upload_conversion.py` parity tests + the §4.3-prescribed `create-a-doc + read-back via
|
||||
authenticated /api/v1.0/documents/`. (Re-enters `DEFERRED.md` entry #5 — this plan IS the
|
||||
re-entry, not operator input.)
|
||||
- **cryptpad** — `DEPS = ["keycloak"]` (cryptpad upstream tests use authentik, but a keycloak-backed
|
||||
cryptpad OIDC test is equally valid and uses the same primitives). The cryptpad create-a-pad
|
||||
Playwright test (DEFERRED #6) is a separate concern — that one really does need a stable
|
||||
CryptPad app-launch contract; it stays deferred.
|
||||
- **lasuite-drive, lasuite-meet** — same pattern when mirrored (`recipe-create-pr` skill — loop work).
|
||||
- Any future recipe that requires OIDC follows this plan; no operator handoff.
|
||||
|
||||
## 6. What stays deferred (genuinely operator-input)
|
||||
|
||||
- **authentik enrollment + `setup_authentik_realm` backend** (DEFERRED #9) — **RESOLVED (operator,
|
||||
2026-05-29): keycloak is our default SSO provider; default ALL recipe OIDC tests to keycloak.** Do
|
||||
NOT test authentik↔keycloak integration, and do NOT enroll authentik just to "prove pluggability"
|
||||
— **Phase-2 DONE is NOT gated on authentik.** Enroll authentik + add `setup_authentik_realm` ONLY
|
||||
if/when a recipe genuinely **requires** authentik (won't work under keycloak). If a recipe works
|
||||
with keycloak, use keycloak. So DEFERRED #9's re-entry trigger narrows to "a recipe requires
|
||||
authentik" — the cross-provider-coverage trigger is dropped. (E.g. cryptpad: its upstream test
|
||||
uses authentik, but test it under **keycloak** — equally valid.)
|
||||
- The `--extra` flag IDEA is **not** a precondition for this plan; OIDC-dep tests are part
|
||||
of the default suite for the recipes that need them.
|
||||
|
||||
## 7. Definition of done for this pattern
|
||||
- [ ] `DEPS = [...]` honored by `runner/run_recipe_ci.py`, with the **deps-AFTER-generic** ordering
|
||||
(§1): deps deploy + `setup_custom_tests` step runs between RESTORE and CUSTOM tiers;
|
||||
`$CCCI_DEPS_FILE` written; deps torn down LAST in reverse order.
|
||||
- [ ] **Failure isolation proven:** a forced `setup_custom_tests` failure (e.g. simulate keycloak
|
||||
realm-setup error) yields a run where generic tiers report **pass** and CUSTOM
|
||||
`requires_deps` tests report **skip(deps-not-ready)** — no false fail of the generic tier,
|
||||
no aborted run.
|
||||
- [ ] **lasuite-docs** ships `tests/lasuite-docs/setup_custom_tests.sh` per §3.2 + authenticated
|
||||
tests per §4 marked `@pytest.mark.requires_deps` (closes DEFERRED #5 — keep the entry there
|
||||
with the closing commit, do not re-defer).
|
||||
- [ ] At least one other OIDC-dep recipe (cryptpad oidc_login or a lasuite-* once mirrored) lands
|
||||
cold-green using the same pattern, demonstrating reuse.
|
||||
- [ ] `docs/sso-dep-testing.md` (in the cc-ci repo) explains the pattern for future recipe
|
||||
enrollments — link to this plan.
|
||||
- [ ] Adversary cold-verifies the full run for one such recipe + the forced-failure isolation
|
||||
case, posts PASS in `REVIEW-2.md`.
|
||||
|
||||
## 8. Mirror+enroll reminder (also loop work)
|
||||
|
||||
If a recipe in scope (e.g. `lasuite-drive`, `lasuite-meet`, `immich`) **isn't mirrored to
|
||||
`git.autonomic.zone/recipe-maintainers/`**, mirror it autonomously via the `recipe-create-pr` skill
|
||||
at `/srv/recipe-maintainer/.opencode/skills/recipe-create-pr/SKILL.md` (see also
|
||||
`plan-phase2-recipe-tests.md §0b`). Mirror+enroll is **not** operator-pending; the bot is admin on
|
||||
the org.
|
||||
@@ -0,0 +1,43 @@
|
||||
# Assistant task — consolidate open recipe PRs (one open PR per recipe)
|
||||
|
||||
**Dispatched:** 2026-06-02 by the orchestrator. **Owner:** the Assistant (one-shot). **Not** the
|
||||
Builder/Adversary loops — they are busy on the regression phase; do not touch their clones.
|
||||
|
||||
## Goal
|
||||
Every recipe mirror should have **at most ONE open PR**. For any recipe with more than one open PR,
|
||||
combine them into a single open PR (the union of their changes) and close the rest.
|
||||
|
||||
## Steps
|
||||
|
||||
1. **Survey.** Creds in `/srv/cc-ci/.testenv` (`GITEA_USERNAME`/`GITEA_PASSWORD`/`GITEA_URL`). For every
|
||||
**recipe** mirror under the `recipe-maintainers` org, list its open PRs:
|
||||
- `GET /api/v1/orgs/recipe-maintainers/repos?limit=100`
|
||||
- `GET /api/v1/repos/recipe-maintainers/<recipe>/pulls?state=open`
|
||||
Recipes = real recipe mirrors only — **exclude** infra repos: `cc-ci`, `cc-ci-orchestrator`,
|
||||
`cc-ci-secrets`, `archived-*`. Build the list of recipes with **>1** open PR.
|
||||
|
||||
2. **Consolidate** each such recipe into ONE open PR holding the union of the changes, then close the others:
|
||||
- Work in a **fresh clone** of the mirror (e.g. under `/tmp`). **Never** use the loops' clones
|
||||
(`/srv/cc-ci/cc-ci`, `/srv/cc-ci/cc-ci-adv`).
|
||||
- Combine the open PR branches onto one branch (cherry-pick/merge). **Never force-push over unmerged
|
||||
work** — preserve every change. Prefer **extending the lowest-numbered open PR** by pushing the
|
||||
combined branch onto its head (the no-force "commit on top" pattern in
|
||||
`/srv/cc-ci/.claude/skills/recipe-upgrade/open-recipe-pr.sh`).
|
||||
- **Conflict policy:** two upgrade PRs to different versions → keep the **newest** version. An upgrade
|
||||
PR + a different-purpose PR (e.g. a backup/restore fix) → include **both** changes.
|
||||
- **Close** the now-redundant PRs with a comment: `Consolidated into #<N> — one open PR per recipe.`
|
||||
- **Re-test** the surviving consolidated PR by commenting `!testme` on it (real CI; results show in
|
||||
the PR; iterate up to 3×). If a genuine pre-existing failure blocks it, leave an explanatory
|
||||
comment — do **not** weaken/skip/delete any test.
|
||||
|
||||
3. **Report & stop.** Summarise: which recipes had >1 open PR, what you consolidated, the surviving PR
|
||||
URL per recipe, conflicts resolved, and any PR left red with an explanatory comment. Then go idle
|
||||
(one-shot — do not loop).
|
||||
|
||||
## Guardrails
|
||||
- **NEVER merge any PR into `main`** — the operator merges. "Merge them together" = consolidate multiple
|
||||
open PRs into ONE open PR, **not** merge to main.
|
||||
- Only touch **recipe mirror** PRs. Do **not** touch cc-ci-repo PRs (build/test PRs).
|
||||
- Recipes with 0 or 1 open PR: leave untouched.
|
||||
- Known starting point (re-verify live — state may have changed): `custom-html` had 2 upgrade PRs
|
||||
(#1 1.12.0, #2 1.13.0); `ghost` had #1 (backup fix) + #2 (upgrade). Survey fresh for the full set.
|
||||
Reference in New Issue
Block a user