Pull MinIO from the Gitea-mirrored pgsty image after upstream Hub/Quay removal.
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
# 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 |
|
||||
@@ -0,0 +1,72 @@
|
||||
# gcp-runner-01 — Gitea Runner 4.0.0 (upgraded from act_runner 0.6.1 on 2026-09-29)
|
||||
#
|
||||
# Only non-default values. Full schema: `gitea-runner config init`.
|
||||
# No hot-reload: `docker compose restart runner` after any edit.
|
||||
# Host is e2-standard-2 (2 vCPU / 8 GB) shared with Gitea and ~15 app containers —
|
||||
# see ../observed-state.md#host-budget before raising anything here.
|
||||
|
||||
log:
|
||||
level: info
|
||||
|
||||
runner:
|
||||
# 2 vCPU / 8 GB shared with Gitea. Measured: one backend job costs ~1 GB of
|
||||
# availability, leaving ~900 MB. Two would land near zero. Do not raise.
|
||||
capacity: 1
|
||||
|
||||
# Let an in-flight job drain on restart instead of being cancelled (default 0s).
|
||||
# compose stop_grace_period must exceed this.
|
||||
shutdown_timeout: 3m
|
||||
|
||||
# The label IS the toolchain image. Mirrored from ghcr.io/catthehacker/ubuntu:act-latest
|
||||
# on 2026-09-29 and digest-pinned; the package is public so the runner pulls anonymously
|
||||
# (runner 2.0 removed implicit pull credentials). Toolchain log: ../observed-state.md.
|
||||
labels:
|
||||
- "ubuntu-latest:docker://git.vectur45.com/trent/ci-ubuntu:act-2026-09-29@sha256:62d572b92f9f32d3427b6d220ad1f9dca9c7b6ffad37d295425037dbff78abaf"
|
||||
|
||||
# A job whose runs-on matches no label above would otherwise pull
|
||||
# docker.gitea.com/runner-images:ubuntu-latest from an external registry.
|
||||
default_image: "git.vectur45.com/trent/ci-ubuntu:act-2026-09-29"
|
||||
|
||||
# One RUNNER_TOOL_CACHE across jobs, so setup-dotnet / setup-node stop re-installing
|
||||
# the same SDK every run. Documented safe ONLY at capacity 1.
|
||||
tool_cache_mode: shared
|
||||
|
||||
cache:
|
||||
enabled: true
|
||||
# Default is $HOME/.cache/actcache INSIDE the container, discarded on every recreate.
|
||||
# On the runner-data volume it survives restarts and image pins.
|
||||
dir: /data/cache
|
||||
# Reuse a cached copy of an action instead of fetching it from github.com on every job.
|
||||
# Trade-off: a moved tag stays at the cached commit until the entry expires.
|
||||
offline_mode: true
|
||||
|
||||
container:
|
||||
# Per-job network with DNS aliases, so `Host=postgres` / `redis:6379` resolve.
|
||||
# Under `bridge` there are no aliases — that is what the old high-port workaround
|
||||
# in ci.yml existed for.
|
||||
network: ""
|
||||
|
||||
# Still wanted for anything genuinely published on the host.
|
||||
# `--memory=3g` was silently ignored on 0.6.1 (HostConfig.Memory: 0). 4.x says
|
||||
# runner-level options keep working where a workflow's are stripped — retest before
|
||||
# trusting it, and re-check ExtraHosts after any edit, since one unparsed flag can
|
||||
# invalidate the whole string.
|
||||
options: >-
|
||||
--add-host=host.docker.internal:host-gateway
|
||||
|
||||
privileged: false
|
||||
valid_volumes: []
|
||||
# 4.x default is already false, and a digest-pinned image is never re-pulled anyway.
|
||||
# Kept explicit so the intent survives a future label change.
|
||||
force_pull: false
|
||||
|
||||
# Pauses task fetching (running jobs continue) when free space drops below the floor.
|
||||
# Also bounds cache eviction. Impossible on 0.6.1.
|
||||
health_check:
|
||||
enabled: true
|
||||
min_free_disk_space_mb: 10240
|
||||
|
||||
metrics:
|
||||
# /metrics, /healthz and /readyz — loopback only, no authentication.
|
||||
enabled: true
|
||||
addr: "127.0.0.1:9101"
|
||||
@@ -0,0 +1,633 @@
|
||||
# Observed platform state
|
||||
|
||||
What this Gitea instance and runner **actually** do, measured — not what the docs describe.
|
||||
Every standard in `CICD/` is written against this file. Re-measure after any Gitea or runner
|
||||
upgrade, because several rows are version-gated.
|
||||
|
||||
- **Measured:** 2026-09-27 (host size 2026-09-28; GrowthOS CI 2026-09-28; GrowthOS CD bake 2026-09-29)
|
||||
- **Instance:** `git.vectur45.com` · **Runner:** `gcp-runner-01` (single, GCP VM)
|
||||
- **Host:** GCP **e2-standard-2** — **2 vCPU / 8 GB**. Gitea, the runner, host Postgres/Redis, and every job share this box.
|
||||
- **Refresh:** see [How to re-measure](#how-to-re-measure)
|
||||
|
||||
---
|
||||
|
||||
## Host budget
|
||||
|
||||
This is the constraint every job and `runner.capacity` decision is written against. It is not
|
||||
a GitHub-hosted 4-core runner.
|
||||
|
||||
| Fact | Value |
|
||||
| --- | --- |
|
||||
| Machine type | `e2-standard-2` |
|
||||
| vCPU | **2** |
|
||||
| Memory | **8 GB** |
|
||||
| Colocated | Gitea, `act_runner` (`network_mode: host` + Docker socket), host Postgres/Redis on `5432`/`6379`, the job container, CI service containers |
|
||||
|
||||
Consequences:
|
||||
|
||||
- **`runner.capacity` stays 1.** Two concurrent .NET jobs, each with Postgres + Redis services, will starve Gitea or OOM. Do not treat capacity as a one-line speed-up on this VM.
|
||||
- **Testhost defaults to every core.** `Environment.ProcessorCount` is 2 — the whole machine. **Every** test/eval step (`dotnet test`, not only unit tests) must set `DOTNET_PROCESSOR_COUNT=1` with workstation GC (`DOTNET_gcServer=0`, `DOTNET_GCHeapCount=1`) so Gitea and the service Postgres keep a vCPU. Uncapped integration testhost crashed the service container mid-run; later tests then failed with `57P03` (database system is in recovery mode). `pg_isready` can pass during that recovery — wait until queries work (`PostgresStartup.WaitUntilAcceptingQueriesAsync`), do not treat the healthcheck as sufficient.
|
||||
- **CD bake is the same budget.** Default `docker buildx bake` compiles api + worker + web + migrate in parallel inside one job and starves Gitea (UI **504**, SSH dead). Keep **one** bake job (do not split into three Gitea jobs). `BUILDKIT_STEP_MAX_PARALLELISM=1` only serializes steps — a single `dotnet publish` still uses both cores and will swap-thrash 8 GB. CD must (1) `docker update --cpus=1 --memory=3g --memory-swap=3g` on the buildkitd container (`CICD/scripts/cap-buildx-builder.sh`) and (2) bake **one target at a time** so push cannot overlap the next compile. SDK stages keep `DOTNET_PROCESSOR_COUNT=1`. Web stages keep a small Node heap (`NODE_OPTIONS=--max-old-space-size=512`, `UV_THREADPOOL_SIZE=1`).
|
||||
- **8 GB is the ceiling, not headroom.** A new EF InMemory internal service provider per database name recompiles the full `AppDbContext` model and will OOM. Share **one** provider **and** one `InMemoryDatabaseRoot` for the assembly; isolate tests with unique database **names**. `InMemoryDatabaseRoot` is a singleton option under `UseInternalServiceProvider` — a new root per test throws. Testcontainers *plus* CI service Postgres is a second database the host cannot afford.
|
||||
- **Scratch `migrate-bundle` needs a command.** `FROM scratch` with only `COPY` has no `CMD`. Bare `docker create IMAGE` fails with `no command specified` after a green bake. Set `CMD ["/out/migrate-api"]` on the stage **and** pass `/out/migrate-api` to `docker create`.
|
||||
|
||||
### If Gitea returns 504 during CD
|
||||
|
||||
The Actions UI cannot cancel the job. SSH will not recover in time.
|
||||
|
||||
Do **not** Stop/Start. An ephemeral external IP is released on Stop and DNS for `git.vectur45.com` (and SSH) would have to be redone. **Reset** is a hard reboot: the instance stays RUNNING and **keeps the ephemeral IP**.
|
||||
|
||||
1. Prefer serial console if it still accepts a login: `docker stop $(docker ps -qf name=buildx_buildkit)` then `./CICD/scripts/runner-host.sh reclaim` from SSH. That is enough when only BuildKit is wedged.
|
||||
2. If the guest is frozen (serial console too): GCP Console → the git VM → **Reset** (or `gcloud compute instances reset NAME --zone=ZONE`). Never Stop.
|
||||
3. After boot, if Gitea is still slow: from a machine that can SSH, `./CICD/scripts/runner-host.sh reclaim <host>` (stops leftover `buildx_buildkit` / `GITEA-ACTIONS` containers).
|
||||
4. In Gitea, cancel the CD run if it is still listed.
|
||||
5. Do not re-run CD until that ref's `cd.yml` calls `cap-buildx-builder.sh` and bakes one target at a time.
|
||||
|
||||
After Gitea is up, promote the current ephemeral IP to a regional static address (same number) so a future Stop cannot change DNS.
|
||||
|
||||
### Measured CI — GrowthOS backend, 2026-09-28 (green)
|
||||
|
||||
After the testhost cap on **all** test steps, shared InMemory provider/root, and `Host=postgres` (no published ports). Same `e2-standard-2`.
|
||||
|
||||
| Step | This run | Before |
|
||||
| --- | --- | --- |
|
||||
| Setup .NET 8 | 1m8s | — |
|
||||
| Restore (`setup-dotnet cache: true` hit) | 2m7s | cold NuGet, folded into compile |
|
||||
| Build (`dotnet build --no-restore`) | **10m12s** | **20–30 min** (swap + cold restore) |
|
||||
| Unit tests (`--no-build`, 370 passed) | **4m34s** | **13m31s abort** (20 fails, hang dump) |
|
||||
| Integration tests (`--no-build`) | **6m0s** green | ~6.5 min with five `57P03` failures |
|
||||
| Agent evals (`--no-build`) | 24s | — |
|
||||
|
||||
Build is still the long pole on two cores with a large EF model. Test time is no longer the thing that makes the job look stuck. Re-record these after a runner or VM change.
|
||||
|
||||
### Measured CI + CD — 2026-09-30, first run through `infra/ci-workflows@v1`
|
||||
|
||||
Structurally faithful — isolated unit tests ran before the service-backed ones, artifacts
|
||||
uploaded, CD green with `builtin:checkout`. **But CI got slower and the cause is not established.**
|
||||
|
||||
| CI step | Via reusable (#67) | Local (2026-09-29) | 2026-09-28 |
|
||||
| --- | --- | --- | --- |
|
||||
| Set up job | 22s | — | — |
|
||||
| `builtin:checkout` | 31s | 14s | — |
|
||||
| Pre-build checks (seed manifests) | 42s | 18s | 22s |
|
||||
| **Setup .NET** | **2m51s** ⚠️ | 1m25s | 56s |
|
||||
| **Restore** | **1m10s** ⚠️ | 18s | 2m21s |
|
||||
| **Build** | **9m59s** ⚠️ | 5m33s | 8m10s |
|
||||
| Test — isolated (unit, 370) | 1m26s | 2m19s | 3m41s |
|
||||
| Test — service-backed (integration + evals) | 3m2s | 3m4s combined | — |
|
||||
| **backend total** | **20m31s** | — | — |
|
||||
| frontend | 2m8s | ~2m18s | — |
|
||||
| changes | 32s | — | — |
|
||||
|
||||
| CD step (#68) | Via `builtin:checkout` | Previous |
|
||||
| --- | --- | --- |
|
||||
| Bake and push images | 1m29s | 1m9s |
|
||||
| Upload migration bundle | 29s | 15s |
|
||||
| build-and-push / migrate / deploy | 2m21s / 1m8s / 1m18s | — |
|
||||
|
||||
**Open: why is CI slower?** Three candidates, in order of likelihood:
|
||||
|
||||
1. **Host contention.** 2 vCPU shared with ~15 app containers. Single samples on this box vary,
|
||||
and Build has ranged 5m33s–10m12s across runs with no pipeline change.
|
||||
2. **A changed NuGet cache key.** `setup-dotnet` now receives
|
||||
`cache-dependency-path: GrowthOS/**/*.csproj` composed from inputs. If the resulting key
|
||||
differs from the one the local workflow used, the first run through the reusable workflow was
|
||||
a cold restore — which fits Restore 18s → 1m10s exactly, and would resolve itself on the
|
||||
next run.
|
||||
3. **`tool_cache_mode: shared`.** Setup .NET has risen monotonically (56s → 1m25s → 2m51s) across
|
||||
the runs since it was enabled. That trend is the one that would not fix itself.
|
||||
|
||||
Decisive check: the `Setup .NET` and `Restore` logs for `Cache restored from key` vs
|
||||
`Cache not found`. Then re-run CI on an unchanged tree — if it returns to ~18s / ~5m30s it was
|
||||
(1) or (2); if it stays slow, suspect (3) and set `tool_cache_mode: none`.
|
||||
|
||||
### Measured CI + CD — 2026-09-29, after Runner 4.0 + artifacts@v4 + builtin:checkout
|
||||
|
||||
Same `e2-standard-2`. Changes since run #59: Runner 4.0.0, `tool_cache_mode: shared`,
|
||||
`cache.offline_mode: true`, artifact actions on `@v4`, `builtin:checkout` in CI.
|
||||
|
||||
| CI step | Now | #59 | 2026-09-28 |
|
||||
| --- | --- | --- | --- |
|
||||
| `builtin:checkout` | **14s** | 8s (`actions/checkout@v4`) | — |
|
||||
| Seed manifests | 18s | 22s | — |
|
||||
| Setup .NET 8 | **1m25s** ⚠️ | 56s | 1m8s |
|
||||
| **Restore** | **18s** | 2m21s | 2m7s |
|
||||
| **Build** | **5m33s** | 8m10s | 10m12s |
|
||||
| Unit tests (370) | **2m19s** | 3m41s | 4m34s |
|
||||
| Integration tests (47) | **2m37s** | 2m56s | 6m0s |
|
||||
| Agent evals (12) | 27s | 37s | 24s |
|
||||
| frontend job (full) | ~2m18s | skipped | — |
|
||||
|
||||
| CD step | Now | #60 | 2026-09-29 (first capped) |
|
||||
| --- | --- | --- | --- |
|
||||
| **Bake and push images** | **1m9s** | 26m1s | 14m29s |
|
||||
| Upload migration bundle (`@v4`) | 15s | 38s | 46s |
|
||||
| Download migration bundle (`@v4`) | 9s | — | — |
|
||||
| Apply migrations | 30s | — | — |
|
||||
|
||||
Reads:
|
||||
|
||||
- **The CD #60 anomaly is answered.** A 1m9s bake on an unchanged source tree is a warm registry
|
||||
cache doing its job; 26m1s was a cold one. The bake time is a function of cache state, not a
|
||||
regression — but it also means a cold bake costs ~26 min, and that is the number to plan around
|
||||
after any builder prune or `runner-host.sh reclaim`.
|
||||
- **Restore 2m21s → 18s** is the largest single CI win; `cache.offline_mode` plus a warm NuGet cache.
|
||||
- **The artifact v4 round trip works in production**, not just in the probe: `cd.yml` uploads the
|
||||
EF bundle in `build-and-push` and `migrate` downloads it, 15s / 9s.
|
||||
- **`builtin:checkout` works in real jobs** — 14s backend, 12s frontend, no Node, no github.com.
|
||||
- ⚠️ **`Setup .NET 8` went 56s → 1m25s** despite `tool_cache_mode: shared`. Either the shared tool
|
||||
cache had to be populated on this first post-upgrade run, or it is not helping here. ⬜ Re-check
|
||||
on the next run before crediting or discarding it.
|
||||
|
||||
### Measured CI — GrowthOS backend, 2026-09-29, run #59 (after the toolchain pin)
|
||||
|
||||
Same `e2-standard-2`. Only change against 2026-09-28 is the mirrored, digest-pinned label image
|
||||
with `force_pull: false` — plus whatever test work landed in between, so attribute cautiously.
|
||||
|
||||
| Step | Run #59 | 2026-09-28 | Note |
|
||||
| --- | --- | --- | --- |
|
||||
| **Set up job** | **12s** | ~2m37s on a cold ghcr.io pull | **The toolchain pin.** Local registry + `force_pull: false`; this is the one delta attributable to that change alone. |
|
||||
| Checkout | 8s | — | |
|
||||
| Seed manifests | 22s | — | |
|
||||
| Setup .NET 8 | 56s | 1m8s | |
|
||||
| Restore (cache hit) | 2m21s | 2m7s | noise |
|
||||
| Build | **8m10s** | 10m12s | still the long pole on 2 cores |
|
||||
| Unit tests | **3m41s** | 4m34s | |
|
||||
| Integration tests | **2m56s** | 6m0s | |
|
||||
| Agent evals | 37s | 24s | |
|
||||
| Publish results | 5s | — | |
|
||||
| Complete job (post steps / cache save) | 2m31s | — | |
|
||||
| **backend job total** | **22m0s** | — | `changes` 22s · `frontend` skipped by path filter (1s) |
|
||||
|
||||
Single runs, not averages. The `Set up job` figure is the clean measurement; the test-step
|
||||
improvements overlap with the testhost-cap work and should not be credited to the toolchain pin.
|
||||
|
||||
### Measured CD — GrowthOS tag deploy, 2026-09-29 (green)
|
||||
|
||||
After `cap-buildx-builder.sh` (`--cpus=1.0 --memory=3g`), one bake target at a time, SDK/Node caps, and scratch `migrate-bundle` `CMD` + `docker create … /out/migrate-api`. Gitea stayed up (no 504). Same `e2-standard-2`.
|
||||
|
||||
| Job / step | This run | Before |
|
||||
| --- | --- | --- |
|
||||
| **build-and-push** (total) | **15m48s** | VM frozen / Gitea 504 under default bake |
|
||||
| Bake and push images | **14m29s** | same failure mode |
|
||||
| Upload migration bundle | 46s | — |
|
||||
| **migrate** | **1m32s** | — |
|
||||
| **deploy** (incl. smoke) | **1m12s** | — |
|
||||
|
||||
First-run `cache-from …:buildcache: not found` is expected and non-fatal; the api bake still wrote `mode=max` cache, and migrate reused it (`inferred cache manifest`). Wall clock is longer than an uncapped parallel bake would be on a bigger machine; the point is Gitea survives. Re-record after a second tag (registry cache warm) or a VM resize.
|
||||
|
||||
---
|
||||
|
||||
## 1. Versions
|
||||
|
||||
| Fact | Value | Source |
|
||||
| --- | --- | --- |
|
||||
| Gitea | **1.27.1** | operator-reported; confirm with `curl -s https://git.vectur45.com/api/v1/version` |
|
||||
| Runner | **4.0.0** (`gitea-runner`) — upgraded from `act_runner` v0.6.1 on 2026-09-29 | Admin → Actions → Runners |
|
||||
| Gitea image | `docker.gitea.com/gitea:latest` — ⬜ digest TODO | compose |
|
||||
| Runner image | `docker.io/gitea/runner:4.0.0` — ⬜ digest TODO | compose |
|
||||
| Runner name | `gcp-runner-01` | `GITEA_RUNNER_NAME` |
|
||||
| Labels registered | `ubuntu-latest:docker://git.vectur45.com/trent/ci-ubuntu:act-2026-09-29@sha256:62d572b92f9f…` | `runner.labels` in `platform/config/runner.yaml` |
|
||||
|
||||
### `:latest` here is worse than usual
|
||||
|
||||
Three separate problems, all from the same two tags:
|
||||
|
||||
1. **`gitea/act_runner` is a retired image name.** The project renamed to `gitea/runner` at v1.0.0
|
||||
and has since shipped **2.0, 3.0 and 4.0** — v4.0.0 released 2026-09-24. So `act_runner:latest`
|
||||
will never advance past the 0.6.x line: `:latest` is giving a *false sense of currency* while
|
||||
pinning by abandonment. This runner is **four majors behind**, and closing that gap means
|
||||
changing the image **name**, not pulling. Docker Hub now describes `gitea/act_runner` as
|
||||
*"Deprecated Gitea runner. Moved to gitea/runner"*, and its last image push was
|
||||
**2026-04-30** — so this runner receives no fixes, security or otherwise, while holding the
|
||||
host Docker socket and the deploy SSH key. Adoption (checked 2026-09-27): `gitea/act_runner`
|
||||
10.15M cumulative pulls vs `gitea/runner` 1.09M in its first ~5 months — the larger number is
|
||||
accumulated history and existing installs re-pulling `:latest`, not current practice.
|
||||
2. **`gitea:latest` is a live moving tag.** Gitea applies DB migrations on startup and **does not
|
||||
support downgrade**, so one `docker compose pull` is a one-way door.
|
||||
3. ~~The label image is a moving third-party tag re-pulled on every job~~ — **resolved 2026-09-29.**
|
||||
Mirrored into `git.vectur45.com/trent/ci-ubuntu`, digest-pinned, `force_pull: false`. The
|
||||
external dependency and the per-job ghcr.io round-trip are gone. **This now needs an owner:**
|
||||
a pinned base receives no upstream fixes until someone re-mirrors it. Monthly is enough at this
|
||||
scale ([dock-senior-001](../../docs/Reference/senior/docker/docker.json) — the deliverable is
|
||||
being able to rebuild within hours of a critical CVE).
|
||||
|
||||
Fix all three by name: `docker.gitea.com/gitea:1.27.1@sha256:…`, `gitea/runner:v4.0.x@sha256:…`
|
||||
(a deliberate migration), and mirror the label image into `git.vectur45.com` digest-pinned with
|
||||
`force_pull: false`. Back up `gitea-data` + the DB before the first Gitea bump.
|
||||
See [dock-junior-012](../../docs/Reference/junior/docker/docker.json),
|
||||
[dock-senior-018](../../docs/Reference/senior/docker/docker.json),
|
||||
[dock-senior-006](../../docs/Reference/senior/docker/docker.json) (mirror third-party images).
|
||||
|
||||
Gitea **1.27.3** exists; this instance is two patches behind on the same minor.
|
||||
|
||||
---
|
||||
|
||||
## 2. Version-gated capabilities (resolved from the versions above)
|
||||
|
||||
| Capability | Available here? | Note |
|
||||
| --- | --- | --- |
|
||||
| **Scoped workflows** (`.gitea/scoped_workflows`, org/instance level) | ✅ **Yes** | Landed in Gitea **1.27.0**. Unblocks the enforced-invariants layer. |
|
||||
| **Reusable workflows** (`on: workflow_call`) | ✅ Yes | |
|
||||
| Actions / reusable workflows from **private** repos | ✅ Yes | Gitea 1.26+. Needs Settings → Actions → General → collaborative owners. |
|
||||
| `gitea.event.inputs` propagated into a reusable workflow | ❌ **No** | Open upstream at 1.27.2, so it applies here. Pass everything via explicit `inputs:`. |
|
||||
| `runner.github_mirror` | ✅ Yes (v0.6.1) | Redirects `uses:` lookups without rewriting YAML or mirroring repos. |
|
||||
| `act_runner cache-server` (shared cache across runners) | ✅ Yes | v0.6.1 has `cache.external_server` + `cache.external_secret`. |
|
||||
| `upload-artifact@v4` | ✅ **works on 4.0** | Verified 2026-09-29, `outcome = success`. Was blocked by the GHES support check on 0.6.1; `patch_actions` + `cache.v2` + `ACTIONS_RESULTS_URL` on the cache server changed that. |
|
||||
| `download-artifact@v4` — the **round trip** | ✅ **works on 4.0** | Verified 2026-09-29: upload in one job, `needs:`, download in another, payload intact. v3 and v4 do not interoperate, so both ends moved in one commit — `ci.yml`, `cd.yml` and the templates. |
|
||||
| `uses: builtin:checkout` | ✅ **works on 4.0** | Verified 2026-09-29, 11s, correct HEAD. No Node runtime and no github.com round-trip. ⬜ Unknown whether it supports `fetch-depth: 0`, which the `changes` job in `ci.yml` needs — adopt per job, not globally. |
|
||||
| `jobs.<id>.environment` (approval gates) | ❌ Ignored | No manual gate; encode promotion in tag patterns. |
|
||||
| `runs-on: [a, b]` multi-label matching | ⚠️ Avoid | Documented incomplete; unverified on v0.6.1. One label per job. |
|
||||
| Digest reference in a label (`…:tag@sha256:…`) | ✅ Yes | Verified 2026-09-29 — v0.6.1 passes the full reference through to the pull. |
|
||||
| Anonymous pull of a public Gitea package by the runner | ✅ Yes | Verified — runner pulls with `username=` empty. Runner v2.0 changes implicit credentials, so keeping the package **public** is what makes this survive the v4 upgrade. |
|
||||
| `GITEA_TOKEN` → container registry push | ❌ No | PAT required (`REGISTRY_USERNAME` / `REGISTRY_TOKEN`). |
|
||||
| `GITEA_TOKEN` injected into every job | ✅ Yes | Job token, not a product PAT. Job containers can reach `git.vectur45.com` (public URL). An app that binds `GITEA_TOKEN` / `Gitea__*` will call this instance unless the workflow blanks those vars. |
|
||||
| Expressions beyond `always()` | ⬜ TODO — probe | Docs say only `always()`. Rollback in `cd.yml` depends on `failure()`. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Live runner config
|
||||
|
||||
**As found (2026-09-27)** the mounted `config.yaml` was four lines, everything else a v0.6.1
|
||||
default, and labels came from `GITEA_RUNNER_LABELS` in compose:
|
||||
|
||||
```yaml
|
||||
container:
|
||||
network: bridge
|
||||
options: >-
|
||||
--add-host=host.docker.internal:host-gateway
|
||||
```
|
||||
|
||||
**As applied (2026-09-28)** — see `config/runner.yaml`. Changed: `container.network` to `""`,
|
||||
`cache.dir` to `/data/cache`, labels moved into the file, `shutdown_timeout: 3m`,
|
||||
`metrics.enabled: true`, `force_pull` made explicit. The table below is the applied state; the
|
||||
probe results in §5 were measured **after** this was live.
|
||||
|
||||
| Key | Value here | Source | Consequence |
|
||||
| --- | --- | --- | --- |
|
||||
| `container.network` | **`""`** (was `bridge`) | explicit | Empty makes the runner build a network per job. **Confirmed working 2026-09-28:** the job landed on `GITEA-ACTIONS-TASK-…-services-network`, and `postgres` / `redis` both resolved *and* accepted TCP by name. Under the previous `bridge` there are no DNS aliases, which is what the high-port + `resolve_host` workaround existed to route around. **That workaround is gone** — `.gitea/workflows/ci.yml` uses `Host=postgres` / `redis:6379` with no published host ports. See [§5](#5-probe-results). |
|
||||
| `container.options` | `--add-host=host.docker.internal:host-gateway` | explicit | Kept. It was the other half of the `bridge` workaround; still wanted for anything genuinely published on the host. **`--memory=3g` does NOT work here**: added 2026-09-29, the job container came back with `HostConfig.Memory: 0`. act's option parser supports only a subset of `docker run` flags on this version (not the documented escape-flag stripping, which is a v3.0 behaviour and does not list `--memory`). Reverted. A single unparsed flag can invalidate the whole string, so re-check `ExtraHosts` after any change here. Retest on v4 — the parser has been extended since (4.0 added `--umask`). |
|
||||
| `runner.capacity` | `1` (default) | default | Jobs **serialise**. `changes → backend → frontend` wall clock is the sum. **Do not raise on this host** — see [Host budget](#host-budget). Capacity > 1 wants a bigger VM or a second runner. |
|
||||
| `runner.labels` | `ubuntu-latest:docker://git.vectur45.com/trent/ci-ubuntu:act-2026-09-29@sha256:62d572b92f9f…` | **config.yaml** (moved off `GITEA_RUNNER_LABELS` 2026-09-28) | **Mirrored 2026-09-29** from `ghcr.io/catthehacker/ubuntu:act-latest`, digest-pinned, package public so the runner pulls anonymously. Full digest in the toolchain log below. |
|
||||
| `container.force_pull` | **`false`** | explicit | Correct now that the label is an immutable self-hosted reference. Probe confirms `forcePull=false` with a green job. |
|
||||
| `cache.enabled` | `true` (default) | default | `actions/cache` server runs. `setup-dotnet cache:` and `setup-node cache: npm` **hit** (probe §5). |
|
||||
| `cache.host` / `port` | `""` / `0` (default) | default | Measured: resolves to `http://10.140.0.2:34585/` (VM internal IP, **random** port) and **is reachable** from job containers. The port changes on every runner restart, so pin `cache.port` before anything firewalls the path between job networks and the host. |
|
||||
| `cache.external_server` | `""` | default | No shared cache. Fine at one runner; prerequisite for runner #2. |
|
||||
| `container.privileged` | `false` (default) | default | Measured: workflow-supplied `options` are **not** stripped on v0.6.1 — `--shm-size=256mb` reached the service container with `Privileged=false`. |
|
||||
| `container.valid_volumes` | `[]` (default) | default | Jobs may mount **no** volumes. |
|
||||
| `container.docker_host` | `""` (auto) | default | Host socket is mounted → the daemon is shared with jobs. |
|
||||
| `container.bind_workdir` | `false` (default) | default | Not needed (no DinD). |
|
||||
| `runner.github_mirror` | `''` (default) | default | `uses: actions/checkout@v4` is fetched from github.com on every run. |
|
||||
| `metrics.enabled` | **`true`** | explicit | `/metrics` and `/healthz` on `127.0.0.1:9101`. |
|
||||
| `runner.timeout` | `3h` (default) | default | |
|
||||
|
||||
### Trust posture
|
||||
|
||||
The runner has the **host Docker socket** *and* `network_mode: host` — root on the VM plus the
|
||||
host's network namespace — and at job time it holds `DEPLOY_SSH_KEY` and the registry PAT. That
|
||||
is acceptable only because every repo it serves is private and trusted; it is not acceptable for
|
||||
any repo taking outside pull requests.
|
||||
See [dock-mid-020](../../docs/Reference/mid/docker/docker.json).
|
||||
|
||||
---
|
||||
|
||||
### Toolchain image log
|
||||
|
||||
The label image is the toolchain every job runs in. Append a row on each re-mirror; never delete
|
||||
one — an old digest is the only record of what a past release was built with.
|
||||
|
||||
| Mirrored | Reference | Digest | Source |
|
||||
| --- | --- | --- | --- |
|
||||
| 2026-09-29 | `git.vectur45.com/trent/ci-ubuntu:act-2026-09-29` | `sha256:62d572b92f9f32d3427b6d220ad1f9dca9c7b6ffad37d295425037dbff78abaf` | `ghcr.io/catthehacker/ubuntu:act-latest` |
|
||||
|
||||
Recover any past toolchain exactly: `docker pull git.vectur45.com/trent/ci-ubuntu@<digest>`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Runner version — the v4 upgrade
|
||||
|
||||
Upgraded 2026-09-29: `gitea/act_runner:0.6.1` → `gitea/runner:4.0.0`, four majors in one hop.
|
||||
The `.runner` registration survived, so no re-registration; rollback is changing the tag back.
|
||||
Probe, CI and CD all green afterwards.
|
||||
|
||||
### Now configured, and impossible before
|
||||
|
||||
| Setting | Value | What it does |
|
||||
| --- | --- | --- |
|
||||
| `health_check.enabled` / `min_free_disk_space_mb` | `true` / `10240` | Pauses **task fetching** (running jobs continue) below the floor. Closes the §7 disk gap that 0.6.1 could not. Also bounds cache eviction. |
|
||||
| `runner.tool_cache_mode` | `shared` | One `RUNNER_TOOL_CACHE` across jobs, so `setup-dotnet` / `setup-node` stop re-installing the same SDK. Documented safe **only at capacity 1** — which is us. |
|
||||
| `cache.offline_mode` | `true` | Reuse a cached action instead of re-fetching from github.com every job. |
|
||||
| `runner.default_image` | the mirrored `ci-ubuntu` | A job whose `runs-on` matches no label would otherwise pull from an external registry. |
|
||||
| `metrics` | `/readyz` added | Task-admission readiness, alongside `/metrics` and `/healthz`. |
|
||||
|
||||
### Available, deliberately not configured
|
||||
|
||||
- **`post_task_script`** — the 4.0 docs are explicit that the runner **stops task heartbeats and
|
||||
appears offline to Gitea while it runs**. A `docker buildx prune` there is not fast enough. Not
|
||||
needed anyway: `workdir_cleanup_age: 24h` + `idle_cleanup_interval: 10m` are **on by default**
|
||||
and remove orphaned per-job networks and volumes — the 137 unused volumes in §7, fixed without
|
||||
configuration.
|
||||
- **`hooks.job_started` / `job_completed`** — run inside the job; either failing fails the job.
|
||||
- **`log.job`** (dir / retention / max_size) — keeps a copy of each task log on disk. Costs disk;
|
||||
left off.
|
||||
- **`cache.s3`**, **`cache.external_server`** — for a second runner. Caches are per-runner today.
|
||||
|
||||
### What v4.x adds that changes the standardization plan
|
||||
|
||||
| v4.x feature | Replaces in the plan |
|
||||
| --- | --- |
|
||||
| `builtin:checkout` — native checkout, no Node runtime in the job image | The github.com dependency for `actions/checkout@v4`, and the need for Node in every golden CI image |
|
||||
| `uses: self:{owner}/{repo}@{ref}` | Absolute-URL references to a shared actions repo, and flipping `DEFAULT_ACTIONS_URL=self` |
|
||||
| `cache.s3` (S3 / MinIO) | `act_runner cache-server` + `external_secret` as the shared-cache mechanism for runner #2 |
|
||||
| OpenTelemetry job traces (`OTEL_*`) | Hand-read timestamps as the source for build-time measurement |
|
||||
|
||||
### Breaking changes crossed (audit list — all resolved at the 2026-09-29 upgrade)
|
||||
|
||||
| Major | Change | Applies here? |
|
||||
| --- | --- | --- |
|
||||
| 2.0 | **Env-var overrides for config disabled** | ⚠️ **Yes** — `GITEA_RUNNER_LABELS` would stop configuring labels. Moving labels into `config.yaml` is a prerequisite. |
|
||||
| 2.0 | `container.force_pull` defaults to **`false`** | ⚠️ Yes — a moving label tag would silently go stale. Digest-pinning becomes mandatory, not optional. |
|
||||
| 2.0 | Docker credentials no longer implicit for all pulls | ⚠️ Yes, once the label image is mirrored into the private Gitea registry — it will need configured creds. |
|
||||
| 3.0 | Container-escaping `options` stripped (`--pid`, `--ipc`, `--uts`, …) | Probably not — `--shm-size` is not an escape option, so the Postgres service flag should survive. Verify. |
|
||||
| 3.0 | Cache service **v2** on by default | Re-test which `actions/cache` major works after upgrading. |
|
||||
| 3.0 | One process per registration file | No — single runner. |
|
||||
| 4.0 | Jobs send cache requests **to the runner**, which forwards them | Verify reachability; set `cache.host`/`cache.port` if the per-job network cannot reach the runner. |
|
||||
| 4.0 | `valid_volumes` matches with doublestar (`/data/**`, not `/data/*`) | No — `valid_volumes: []`. |
|
||||
| all | **The `.runner` registration file stays valid across versions** | No re-registration needed; rollback is changing the image tag back. |
|
||||
|
||||
---
|
||||
|
||||
## 5. Probe results
|
||||
|
||||
### Run 2026-09-29 — Gitea Runner **4.0.0** (post-upgrade). Everything survived four majors.
|
||||
|
||||
| Probe | Expected | Observed | Note |
|
||||
| --- | --- | --- | --- |
|
||||
| `always()` fires | ran | ✅ ran | |
|
||||
| `failure()` fires | ran | ✅ ran | `cd.yml` rollback still valid after 3.0 |
|
||||
| `success()` skipped after failure | skipped | ✅ skipped | |
|
||||
| `cancelled()` skipped | skipped | ✅ skipped | |
|
||||
| `--shm-size=256mb` on a service container | `268435456` | ✅ **`268435456`**, `/dev/shm` 256M, `Privileged=false` | 3.0's option stripping does **not** touch `--shm-size` |
|
||||
| `postgres` / `redis` resolve | yes | ✅ both | per-job `…-services-network` unchanged |
|
||||
| TCP to `postgres:5432` / `redis:6379` by name | connects | ✅ both | |
|
||||
| `ACTIONS_CACHE_URL` | set | `http://10.140.0.2:43447/` | |
|
||||
| **`ACTIONS_RESULTS_URL`** | — | **`http://10.140.0.2:43447`** | **Changed.** On 0.6.1 this was the Gitea instance; on 4.0 it is the runner's own cache server — this is `cache.v2`, under which artifact uploads also go through the cache server. |
|
||||
| Cache endpoint reachable | HTTP, not 000 | ✅ HTTP 404 | 4.0 routes job cache through the runner; no `cache.host`/`port` needed with `network_mode: host` |
|
||||
| `actions/cache@v3` round-trip | HIT on 2nd run | ✅ **HIT** — restored a stamp from **2026-09-27** | the entry outlived the `cache.dir` move **and** the v4 upgrade |
|
||||
| Cache step duration | — | **1s** (was 24s on 0.6.1) | |
|
||||
| `Set up job` | — | **5s / 13s** (was ~2m37s cold on ghcr.io) | mirrored + digest-pinned toolchain |
|
||||
|
||||
Nothing regressed, so no rule in `CICD/` changes as a result of the upgrade. The one new fact is
|
||||
`ACTIONS_RESULTS_URL` pointing at the cache server — which is why `upload-artifact@v4` is now
|
||||
worth retesting (see §2).
|
||||
|
||||
### Run 1: 2026-09-28 — act_runner v0.6.1 (superseded, kept for comparison)
|
||||
|
||||
Run 1: 2026-09-28, Gitea 1.27.1 / act_runner v0.6.1, **after** applying the new `config.yaml`
|
||||
(`container.network: ""`, `cache.dir: /data/cache`).
|
||||
|
||||
| Probe | Expected if healthy | Observed | Note |
|
||||
| --- | --- | --- | --- |
|
||||
| `always()` fires | ran | ✅ **ran** | |
|
||||
| `failure()` fires | ran | ✅ **ran** | |
|
||||
| `success()` skipped after failure | not ran | ✅ **skipped** | |
|
||||
| `cancelled()` skipped | not ran | ✅ **skipped** | |
|
||||
| job-level `if: always()` with a failed `needs` | job runs | ✅ **ran** | `needs-context` executed |
|
||||
| `needs.<job>.result` populated | `failure` | ✅ **`'failure'`** | |
|
||||
| `ACTIONS_CACHE_URL` set | non-empty | ✅ `http://10.140.0.2:34585/` | `ACTIONS_RESULTS_URL` = the Gitea instance |
|
||||
| cache endpoint reachable from job container | HTTP, not `000` | ✅ **HTTP 404** | 404 on `/` is the cache server answering — it is reachable |
|
||||
| `actions/cache@v3` round-trip, run 1 | miss | ✅ `Cache not found for input keys` | |
|
||||
| `actions/cache@v3` round-trip, run 2 | restored from key | ✅ **HIT** (operator-confirmed) | run 2 total 1m36s vs 3m16s for the cache job alone on run 1 |
|
||||
| service `--shm-size=256mb` honoured | `ShmSize=268435456` | ✅ **`268435456`**, `/dev/shm` 256M | not stripped; `Privileged=false` |
|
||||
| `getent hosts postgres` / `redis` | resolves | ✅ **both resolve** | |
|
||||
| TCP to `postgres:5432` / `redis:6379` by name | connects | ✅ **both reachable** | |
|
||||
| Job network | per-job, not the default bridge | `GITEA-ACTIONS-TASK-…-JOB-services-…-services-network` | what `container.network: ""` produces |
|
||||
|
||||
### Conclusion: the network change works — the `ci.yml` workaround is gone
|
||||
|
||||
With `container.network: ""` the runner builds a network per job, attaches the job container to
|
||||
it, and registers each service under its name. Measured: `postgres` and `redis` both resolved and
|
||||
both accepted TCP connections by name.
|
||||
|
||||
Consequences (applied 2026-09-28):
|
||||
|
||||
- The invariant in [`ci-cd-build-cache.md` §8](../ci-cd-build-cache.md) is **service DNS, no
|
||||
published host ports**, gated on `container.network: ""`. The old high-port + host-discovery
|
||||
rule described `container.network: bridge` and is retired. The [hybrid playbook
|
||||
anti-pattern row](../hybrid-gcp-tailscale-cicd.md) names `container.network` as the variable.
|
||||
- `.gitea/workflows/ci.yml` uses `Host=postgres` and `redis:6379`. Do not reintroduce
|
||||
`ports: 54329:5432` / host-discovery.
|
||||
- Copy the same shape into [`CICD/templates/workflows/ci.yml`](../templates/workflows/ci.yml).
|
||||
|
||||
`pg_isready` is not “Postgres is ready for tests.” Crash recovery (`57P03`) accepts TCP while
|
||||
queries still fail. Service `--shm-size=256mb` + `--health-start-period` plus an application-level
|
||||
wait-for-queries (and a testhost cap so the container does not crash mid-run) are the trio that
|
||||
kept integration green. See [Host budget](#host-budget).
|
||||
|
||||
### Conclusion: RabbitMQ must not be a workflow `services:` entry (2026-09-30)
|
||||
|
||||
"Service containers are reached by name" holds for **Postgres and Redis and not for RabbitMQ**.
|
||||
Measured on Runner 4.0.0 / e2-standard-2 while onboarding a Node service: declaring `rabbitmq`
|
||||
under `jobs.*.services` fails the service health check **before any step runs**:
|
||||
|
||||
```text
|
||||
the service 'rabbitmq' is unhealthy:
|
||||
Failed to connect and authenticate to rabbit@… in 60000 ms
|
||||
```
|
||||
|
||||
A fixed hostname, `RABBITMQ_NODENAME`, plain alpine (no management UI), a longer
|
||||
`--health-start-period` and `--shm-size` all failed to clear it. The job never starts, so no
|
||||
step-level workaround is reachable.
|
||||
|
||||
**Working pattern:** start brokers with `docker run` on the job container's own Docker network —
|
||||
[`scripts/start-job-sidecars.sh`](../scripts/start-job-sidecars.sh) — with unique container
|
||||
names, a fixed RabbitMQ hostname/nodename, connecting by **container IP** where the network is
|
||||
the default `bridge` (no embedded DNS), an AMQP probe from the job before tests, and cleanup
|
||||
under `if: always()`. Requires the Docker socket on the runner, which this runner has.
|
||||
|
||||
Wrapped for reuse as
|
||||
[`infra/ci-workflows/.../node-service-ci.yml`](../infra/ci-workflows/.gitea/workflows/node-service-ci.yml).
|
||||
|
||||
Also seen: Gitea logs `'runs-on' key not defined in CI/<job>` for reusable callers that omit a
|
||||
local `runs-on`. Expected noise, not a service failure.
|
||||
|
||||
### Conclusion: the expression set behaves like GitHub Actions
|
||||
|
||||
`docs.gitea.com/usage/actions/comparison` states *"For expressions, only `always()` is supported."*
|
||||
**That is not true of Gitea 1.27.1 with act_runner v0.6.1.** Measured: `always()` and `failure()`
|
||||
both fired after a failed step, `success()` and `cancelled()` were both correctly skipped, and a
|
||||
job with `if: always()` ran despite a failed `needs`.
|
||||
|
||||
Consequences:
|
||||
|
||||
- The `Roll back on failure` step in `.gitea/workflows/cd.yml` (`if: failure()`) **works as
|
||||
written**. No redesign needed — this removes a planned work item.
|
||||
- `if: failure()` is *not* on the enforced-invariants list after all. Keep the ban on
|
||||
`jobs.<id>.environment`; the `upload-artifact@v4` ban retired on 2026-09-29 (Runner 4.0), and
|
||||
the expression ban never applied here.
|
||||
- Re-measure this after the v4 runner upgrade; it is runner behaviour, not a documented guarantee,
|
||||
and the docs disclaim it.
|
||||
|
||||
---
|
||||
|
||||
## 6. Platform compose stack
|
||||
|
||||
Single GCP **e2-standard-2** (2 vCPU / 8 GB). Gitea publishes `8181:3000` and `2222:22`; TLS for
|
||||
`git.vectur45.com` terminates in something outside this stack. The runner is `network_mode: host`
|
||||
and reaches Gitea via the public URL, so runner→Gitea job fetching hairpins out through DNS and
|
||||
the reverse proxy. A job that uses both vCPUs makes Gitea stall.
|
||||
|
||||
Gaps against [arch-040](../../docs/Reference/architecture/walkthroughs.json) (running a real
|
||||
product on one Docker host):
|
||||
|
||||
| Gap | Effect | Reference |
|
||||
| --- | --- | --- |
|
||||
| No `logging:` options on either service | Default `json-file` has **no rotation**; a full `/var/lib/docker` takes down Gitea, the runner and every job at once | [dock-mid-014](../../docs/Reference/mid/docker/docker.json), arch-040 step 6 |
|
||||
| No `healthcheck:` on either service | `depends_on` orders starts only; nothing detects a wedged Gitea | [dock-junior-018](../../docs/Reference/junior/docker/docker.json), [dock-junior-023](../../docs/Reference/junior/docker/docker.json) |
|
||||
| No resource limits | A runaway build or uncapped testhost takes both vCPUs; Gitea stalls on the same VM | |
|
||||
| No scheduled `docker image prune` / `builder prune` | Build cache and per-job images grow without bound; v0.6.1 has no `health_check` to pause fetching on low disk | arch-040 step 6 |
|
||||
| No documented backup or **restore test** for `gitea-data` + DB | Gitea cannot be downgraded; the repo host is the one thing with no rebuild path | [dock-mid-016](../../docs/Reference/mid/docker/docker.json), [dock-senior-015](../../docs/Reference/senior/docker/docker.json) |
|
||||
| Both images on `:latest` | See §1 | [dock-junior-012](../../docs/Reference/junior/docker/docker.json) |
|
||||
|
||||
---
|
||||
|
||||
## 7. Host — raw measurements
|
||||
|
||||
The **rules** derived from this host live in [Host budget](#host-budget) at the top of this file;
|
||||
the documents in `CICD/` link there. This section holds the readings those rules are built on, so
|
||||
they can be re-taken and compared rather than re-argued.
|
||||
|
||||
Measured 2026-09-29. **One VM runs everything**: Gitea, the runner, every job container, every
|
||||
build — and, on the evidence of 73 running containers, the live demo stacks as well.
|
||||
|
||||
| Fact | Value | Note |
|
||||
| --- | --- | --- |
|
||||
| Machine type | **e2-standard-2** | 2 vCPU, 8 GB. Full-core, *not* shared-core — no burstable throttling to chase. |
|
||||
| vCPU | **2** | |
|
||||
| RAM | 7.8 Gi total · 4.6 Gi used · **1.9 Gi available** · **swap 0** | The binding constraint. |
|
||||
| Disk | 291 G, 53 G used, **239 G free (19 %)** | `/var/lib/docker` is on `/`. Not a risk today. |
|
||||
| Images | 73 (68 active) · 14.45 GB · 3.54 GB reclaimable | |
|
||||
| Containers | **73, all running** | Gitea + runner is 2 of them. The rest is other workload on the same box. |
|
||||
| Local volumes | 161 (**24 active**) · 17.39 GB · 5.09 GB reclaimable | 137 unused. **Do not blanket-prune** — see below. |
|
||||
| Build cache | 0 B | Misleading: CD builds on a `docker-container` buildx builder, whose cache lives in a *volume*, not the daemon's build cache. It is inside the 17.39 GB above. |
|
||||
|
||||
### How the capacity number was derived
|
||||
|
||||
`floor(vCPU / 2)` = **1** and `floor((RAM_GB − 2) / 4)` = **1**. Both agree, neither is close, so
|
||||
`runner.capacity: 1` is not a judgement call. The rule and its consequences are in
|
||||
[Host budget](#host-budget); a second concurrent .NET job is an OOM risk against the workload
|
||||
already on the box ([dock-mid-009](../../docs/Reference/mid/docker/docker.json), exit 137).
|
||||
|
||||
### Memory, not disk, is the constraint — measured under load
|
||||
|
||||
Disk was the assumed risk and the numbers disprove it: 239 GB free. RAM is the ceiling.
|
||||
|
||||
Measured during CI run #1276 (`backend` job, .NET restore/build/test with Postgres + Redis
|
||||
service containers):
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| Job container peak RSS | **832 MiB** (not the 3–4 GB assumed) |
|
||||
| Job container CPU | 20–30 % of 200 % — **not** CPU-saturated |
|
||||
| Host available memory, minimum | **919 MB** |
|
||||
| OOM kills | none |
|
||||
| Co-tenants | ~15 app containers, 138–250 MiB each, most already capped at 1–2 GB |
|
||||
|
||||
**Verdict: the VM holds CI today, with roughly 900 MB of headroom and no swap.**
|
||||
|
||||
It also confirms the capacity number quantitatively: one job costs ~1 GB of availability
|
||||
(1.9 GB → 919 MB). A second concurrent job would land near zero and the OOM killer would pick a
|
||||
victim — and CI job containers have **no memory limit**, while the demo containers do, so the
|
||||
kernel's choice is not guaranteed to be the build. See the `--memory` finding in §3: capping the
|
||||
job container is **not available** on v0.6.1.
|
||||
|
||||
Measured during CD run #1280 (`build-and-push`, `buildx bake` of three images + the EF bundle):
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| CD job container | 160 MiB — the job only orchestrates |
|
||||
| `buildx_buildkit_growth-os-builder0` | peak **656 MiB**, already capped at **3 GiB**, CPU up to 47 % |
|
||||
| Host available, minimum | **942 MB** transient (single sample, between readings of 1799 and 1779 MB); otherwise > 1250 MB |
|
||||
| OOM kills | none |
|
||||
|
||||
**CD is lighter on memory than CI.** The heaviest single thing this box runs is the `backend` CI
|
||||
job at 832 MiB, not the bake — because the build happens inside the BuildKit container, which is
|
||||
already limited to 3 GiB. Both pipelines fit with ~900 MB–1.2 GB of headroom.
|
||||
|
||||
⬜ Still unmeasured: the `frontend` job (npm + vite).
|
||||
|
||||
### Structural note: this box both builds and serves
|
||||
|
||||
`growth_os_api`, `growth_os_worker` and ~13 other application containers run on the same VM as the
|
||||
runner and BuildKit. [arch-040](../../docs/Reference/architecture/walkthroughs.json) step 1 is
|
||||
explicit that *"the server never builds"* — building on the serving box couples deploys to build
|
||||
failures, competes for CPU with users, and puts source and build credentials on a host that should
|
||||
hold neither. Measured impact today is tolerable (BuildKit peaked at 47 % of 200 %, nothing was
|
||||
OOM-killed), so this is a **ceiling, not an incident**: it is what will bind first when a second
|
||||
project's CI arrives, or when `capacity` needs to rise. A dedicated runner VM resolves it together
|
||||
with the blast-radius problem above.
|
||||
|
||||
### Pruning, specifically
|
||||
|
||||
| Command | Verdict |
|
||||
| --- | --- |
|
||||
| `docker image prune -f` | ✅ safe, ~3.5 GB |
|
||||
| `docker buildx prune --builder growth-os-builder --filter until=168h` | ✅ this is the one that reaches the CD build cache. `docker builder prune` alone touches the default builder and does nothing here. |
|
||||
| `docker volume prune` | ❌ **do not run.** 137 unused volumes, and this box holds application data. This is exactly [dock-junior-025](../../docs/Reference/junior/docker/docker.json) — "`--volumes` deletes your databases". Inspect and remove individually if space is ever needed. |
|
||||
|
||||
### Blast radius
|
||||
|
||||
The runner holds the **host Docker socket** (root on this VM) and `network_mode: host`, and at job
|
||||
time it holds `DEPLOY_SSH_KEY` and the registry PAT — on the same machine as Gitea and ~71 other
|
||||
running containers. Any CI job, and any compromise of a co-tenant, reaches all of it. Acceptable
|
||||
only while every repo served is private and trusted
|
||||
([dock-mid-020](../../docs/Reference/mid/docker/docker.json)). A dedicated runner VM fixes the
|
||||
contention and the blast radius in one move.
|
||||
|
||||
### Host hygiene
|
||||
|
||||
| Gap | Status |
|
||||
| --- | --- |
|
||||
| Scheduled `docker image prune` + `docker buildx prune --builder …` | ⬜ none — low urgency at 19 % disk |
|
||||
| Log rotation on the Gitea + runner containers | ⬜ see §6 |
|
||||
| Memory alerting | ⬜ none — **this is the one that matters here** |
|
||||
| Swapfile (absorbs a build spike instead of OOM-killing a container) | ⬜ none — 0 B swap |
|
||||
| Memory cap on CI job containers | ❌ **not possible on v0.6.1** — `--memory` is silently ignored by act's option parser (see §3). Retest after the v4 upgrade. Swap is the mitigation that does not depend on a parser. |
|
||||
| Backup + **restore test** for `gitea-data` and the DB | ⬜ none |
|
||||
|
||||
---
|
||||
|
||||
## How to re-measure
|
||||
|
||||
1. Host — GCP machine type (`e2-standard-2` today). Re-check if the VM is resized; every
|
||||
capacity / testhost-cap rule depends on it.
|
||||
2. Versions — `curl -s https://git.vectur45.com/api/v1/version`; Admin → Actions → Runners.
|
||||
3. Digests — `docker inspect` the container for `.Image`, then `docker image inspect` that id for
|
||||
`.RepoDigests` (containers carry no digest field).
|
||||
4. Config — `cat` the mounted `config.yaml`, and diff against
|
||||
`act_runner generate-config` run from the **running image** to see which defaults apply.
|
||||
5. Labels — `runner.labels` in `platform/config/runner.yaml` (not `GITEA_RUNNER_LABELS`).
|
||||
Confirm in the admin UI.
|
||||
6. Probes — re-run `probe.yml`.
|
||||
7. Green backend job — record step timestamps in [Host budget](#host-budget) (build, unit,
|
||||
integration). A testhost or InMemory change that “fixes tests” can still move compile time.
|
||||
8. Green CD tag — record bake / migrate / deploy timestamps in [Host budget](#host-budget).
|
||||
Confirm Gitea stays responsive during bake and that `docker create` of the scratch
|
||||
migrate-bundle succeeds.
|
||||
|
||||
Re-measure on: any Gitea minor bump, any runner image change, any `config.yaml` or compose edit
|
||||
(the runner does not hot-reload — it needs a restart), or a VM resize (machine type is the
|
||||
host budget).
|
||||
|
||||
---
|
||||
|
||||
**Reference behind these rows:** [dock-junior-012](../../docs/Reference/junior/docker/docker.json)
|
||||
(`:latest`), [dock-junior-017](../../docs/Reference/junior/docker/docker.json) (service names vs
|
||||
localhost), [dock-mid-005](../../docs/Reference/mid/docker/docker.json) (CI cache backends),
|
||||
[dock-mid-010](../../docs/Reference/mid/docker/docker.json) (network drivers, publishing),
|
||||
[dock-mid-014](../../docs/Reference/mid/docker/docker.json) (log rotation),
|
||||
[dock-mid-020](../../docs/Reference/mid/docker/docker.json) (socket mount = root on host),
|
||||
[dock-senior-001](../../docs/Reference/senior/docker/docker.json) (golden base images),
|
||||
[dock-senior-006](../../docs/Reference/senior/docker/docker.json) (mirror third-party images),
|
||||
[arch-039](../../docs/Reference/architecture/walkthroughs.json) (measure before caching),
|
||||
[arch-040](../../docs/Reference/architecture/walkthroughs.json) (one Docker host).
|
||||
Reference in New Issue
Block a user