Files
Trent 1c1065938f
CI / changes (push) Successful in 47s
CI / frontend (push) Skipped
CI / backend (push) Successful in 43m10s
Pull MinIO from the Gitea-mirrored pgsty image after upstream Hub/Quay removal.
2026-09-30 23:09:01 +08:00

129 lines
10 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Platform change log
What changed on this CI/CD platform, why, and what evidence justified it.
[`observed-state.md`](observed-state.md) says what is true **now**; this file says how it got
there, so a decision can be re-opened without re-deriving it.
Period covered: **2026-09-27 → 2026-09-30**.
---
## Initial state (as found, 2026-09-27)
| Area | State |
| --- | --- |
| Gitea | 1.27.1, image `docker.gitea.com/gitea:latest` — unpinned |
| Runner | `gitea/act_runner:latest` → v0.6.1. **Deprecated and frozen since 2026-04-30**; `:latest` could never advance past it because the project had been renamed to `gitea/runner`. No security fixes. |
| Runner config | Four lines: `container.network: bridge` and one `--add-host`. Everything else defaults, nothing in version control. |
| Toolchain image | `ghcr.io/catthehacker/ubuntu:act-latest` — a third-party **moving tag** on a public registry, re-pulled on every job (`force_pull: true`). ~2m37s on a cold pull. |
| Labels | From `GITEA_RUNNER_LABELS` in compose, not reviewable |
| Cache | `actions/cache` enabled, but `cache.dir` defaulted to a path **inside the container** — discarded on every recreate |
| Capacity | 1, never measured against the host |
| Host | GCP `e2-standard-2` (2 vCPU / 8 GB), shared with Gitea and ~15 application containers. **Unrecorded anywhere.** |
| CI | Postgres/Redis published on host ports `54329`/`63799` plus a 40-line host-discovery step; `upload-artifact@v3`; `actions/checkout@v4` |
| CD | Artifact actions `@v3` both ends |
| Docs | Two playbooks giving **contradictory** rules for CI service networking. Neither named the variable that decided it. The same act_runner assumptions were re-derived in four places. |
## Current state (2026-09-30)
| Area | State |
| --- | --- |
| Gitea | 1.27.1, pinned |
| Runner | **`gitea/runner:4.0.0`** — four majors forward, registration preserved |
| Runner config | [`config/runner.yaml`](config/runner.yaml), version-controlled and mirrored from the VM |
| Toolchain image | Mirrored to `git.vectur45.com/trent/ci-ubuntu`, **digest-pinned**, package public, `force_pull: false`. Set up job: **5–22s**. |
| Cache | `dir: /data/cache` on the runner volume, `offline_mode: true`, survives restarts and upgrades |
| Guards | `health_check` pauses fetching below 10 GB free; `metrics` on loopback |
| Host | Measured under CI **and** CD load and recorded, with a capacity rule derived from it |
| CI | Service containers **by name** on a per-job network; artifacts `@v4`; `builtin:checkout`; testhost capped to one core on every test step |
| CD | Same, plus a cgroup-capped BuildKit builder and one bake target at a time |
| Pipelines | Extracted to `infra/ci-workflows@v1`. GrowthOS's `ci.yml`: **267 → 145 lines** |
| Docs | [`observed-state.md`](observed-state.md) is the single source of truth; both playbooks corrected and cross-linked to it; [`probe.yml`](../../.gitea/workflows/probe.yml) is a standing regression check |
---
## What changed, in order
| Date | Change | Why / evidence |
| --- | --- | --- |
| 09-27 | Measured the platform into `observed-state.md` | Nothing recorded the Gitea version, runner version, runner config or host. Four documents were guessing. |
| 09-28 | `container.network: bridge` → `""` | `bridge` gives no Docker DNS aliases. Probe confirmed `postgres`/`redis` resolve on a per-job network. |
| 09-28 | Removed published DB ports + 40-line host discovery from `ci.yml` | Made obsolete by the above. −53 lines. |
| 09-28 | `cache.dir` → `/data/cache` | The default lived inside the container and was lost on every recreate. |
| 09-28 | Labels moved from env into `config.yaml` | Reviewable, and a prerequisite for runner 2.0+, which removed env-var config overrides. |
| 09-28 | `shutdown_timeout: 3m` + compose `stop_grace_period` | Default `0s` cancelled in-flight jobs on restart. |
| 09-28 | `metrics.enabled: true` | The build-cache playbook opens with "measure first" and had no source of numbers. |
| 09-28 | Testhost capped (`DOTNET_PROCESSOR_COUNT=1`) on **every** test step | Uncapped testhost took both cores, crashed the service Postgres, and later tests failed `57P03`. Unit 13m31s abort → 4m34s green. |
| 09-29 | CD bake capped (`cap-buildx-builder.sh`, one target at a time) | Default parallel bake froze the VM and returned Gitea 504. |
| 09-29 | Both images pinned; `gitea/act_runner` documented as retired | Gitea cannot be downgraded after a migration; the runner tag was a dead end. |
| 09-29 | Toolchain mirrored, digest-pinned, `force_pull: false` | Removed a third-party moving tag and a per-job ghcr.io round-trip. Set up job 2m37s → 12s. |
| 09-29 | Runner → `gitea/runner:4.0.0` | The 0.6.x line is deprecated and frozen; it holds the Docker socket and the deploy key. Probe green afterwards. |
| 09-29 | `health_check`, `tool_cache_mode: shared`, `cache.offline_mode`, `default_image` | All impossible on 0.6.1. |
| 09-29 | Artifact actions → `@v4`, both ends in one commit | Round trip verified first: v3 and v4 use different backends and do not interoperate. |
| 09-29 | `builtin:checkout` in CI, then CD | No Node runtime, no github.com round-trip. `changes` stays on `actions/checkout@v4` pending a `fetch-depth` result. |
| 09-30 | Pipelines extracted to `infra/ci-workflows@v1` | First change that pays off per project rather than per repo. |
---
## 2026-09-30 — three projects onboarded, improvements folded back
`CICD/` was copied into three project kits (`fleet_telemetry`, `pos`, `inline_inspection`) while
onboarding those repos. What came back:
| Taken | From | Why |
| --- | --- | --- |
| RabbitMQ cannot be a workflow `services:` entry; `start-job-sidecars.sh` + `node-service-ci.yml` | pos | A **measurement that contradicted a generalization in these docs**. "Service containers by name" holds for Postgres/Redis and fails for RabbitMQ — health fails before any step runs. |
| `runner-host.sh` enumerates docker-container builders instead of naming them | pos | The hardcoded list went stale on every onboarding. `inline_inspection` changed it the other way, to one hardcoded name — a regression, not taken. |
| `node-ci.yml` gains `post_build_command` and a documented phase order | fleet_telemetry | There was nowhere to put a check that needs `dist/` (bundle budget, e2e); `extra_check_command` runs before the build. |
| `templates/` replaces `.gitea_example/` + the two loose `*_example` files | fleet_telemetry | `.gitea_example/` had `fleet-telemetry` baked into 10+ places — registry namespace, builder name, bundle name, `/tmp` paths, compose project name. Anyone copying it inherited another product's identity. |
| Testcontainers note on `dotnet8-ci.yml` | fleet_telemetry | Names the exact point where someone would otherwise fork the workflow. |
| Generic monorepo and dotnet+node caller examples | pos | The only example was GrowthOS-specific. |
**Not taken:** path rewrites local to each kit (`docs/CICD/…`, "in this kit"); inline's hardcoded
builder name. **Reconciled:** `node-service-ci.yml` defaulted Node 20 against `node-ci.yml`'s 22 —
now 22 in both, with a note telling callers to pin it explicitly.
### The result worth recording
**`dotnet8-ci.yml` diverged across all three kits only in comments and example values.** Not one
needed a new input to build and test a .NET service. That is the validation the extraction was
waiting for. `node-ci.yml` needed exactly one new input.
### The failure mode it also demonstrated
Four copies of `dotnet8-ci.yml`, `runner.yaml`, `observed-state.md` and the scripts existed
simultaneously and had already diverged — one making a script worse. That is the duplication the
shared repo exists to end, reintroduced one directory up. `onboarding-a-project.md` §6 now says
a project keeps its caller, `cd.yml` and templates, and links back here for everything else.
---
## Conclusions that were wrong, and what corrected them
Kept deliberately. Each of these was stated with confidence and then disproved by a measurement;
the pattern is the reason `observed-state.md` exists.
| Claim | Reality | Corrected by |
| --- | --- | --- |
| "Service DNS already works, `bridge` was innocent" | It was not. The probe had been run **after** the config change. `bridge` really was the cause. | Reading the job's network name against the change timeline |
| "Disk hygiene is the urgent risk" | 239 GB free, 19 % used. **Memory** was the constraint — 1.9 GB available, no swap. | `df` + `docker system df` |
| "A backend CI job needs 3–4 GB" | 832 MiB peak. | `docker stats` under load |
| "Cap job containers with `container.options: --memory=3g`" | Silently ignored on 0.6.1 — `HostConfig.Memory: 0`. act's parser supports a subset of `docker run` flags. | `docker inspect` on a job container |
| "`--shm-size` may be stripped by runner 3.0" | Not stripped. The strip list covers container-**escaping** flags only. | Probe, `ShmSize=268435456` |
| "Only `always()` is supported" (Gitea docs) | `failure()`, `success()` and `cancelled()` all behave like GitHub Actions, on 0.6.1 **and** 4.0.0. | Probe `expressions` job |
| "`upload-artifact@v4` is broken on Gitea" | True on 0.6.1; works on 4.0.0 with `patch_actions` + `cache.v2`. | Probe, then a production CD round trip |
| "CD bake regressed from 14m29s to 26m1s" | Not a regression — bake time is a function of registry cache state. A warm bake is **1m9s**; a cold one ~26 min. | A later warm run |
---
## Open
| Item | Status |
| --- | --- |
| CI slower through the reusable workflow (Setup .NET 2m51s, Restore 1m10s, Build 9m59s) | ⬜ Re-run on an unchanged tree. Candidates: host contention, a cold NuGet cache from a changed key, or `tool_cache_mode: shared` — which has risen monotonically since it was enabled. |
| `builtin:checkout` with `fetch-depth: 0` | ⬜ `probe.yml` job `builtin-checkout-depth` answers it; decides whether the `changes` job can migrate |
| Runner image digest pin | ⬜ `docker image inspect docker.io/gitea/runner:4.0.0 -f '{{index .RepoDigests 0}}'` |
| Monthly toolchain re-mirror | ⬜ needs an owner; a pinned base receives no upstream fixes |
| Swapfile, memory alerting, `gitea-data` backup + **restore test** | ⬜ see [observed-state §7](observed-state.md#7-host-raw-measurements) |
| Second project onboarded | ⬜ the only real test of whether the shared workflows generalize |