ci(390): run toolchain jobs in the shared CI image; drop 110s apt-ffmpeg; rebalance lanes
Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 9s
Build ErsatzTV Image / decisions.md append-only (pull_request) Successful in 10s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 13s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 13s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Failing after 4m31s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 9m22s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Failing after 6m8s
Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 9s
Build ErsatzTV Image / decisions.md append-only (pull_request) Successful in 10s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 13s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 13s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Failing after 4m31s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 9m22s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Failing after 6m8s
Converts test/migrations/functional-e2e/api-docs/format to run inside ersatztv-ci:6a9e27c via container:, removing per-run setup-dotnet, setup-node, apt-get ffmpeg and dotnet tool install. NuGet/npm caches stay (project deps); setup-node's implicit npm cache is replaced with an explicit actions/cache. Rolled-up wins found while auditing every job's steps (evidence in #390): - Drop the apt-ffmpeg step (110s/run). It was never load-bearing: the app's only startup ffmpeg touch is a LogWarning from FFmpegLocatorService, and the harness drives curl-only contracts that never transcode. The image ships prod-identical ffmpeg 8.1.2 anyway, which #299's seeded-media follow-ups will need. - Bake dotnet-ef + reportgenerator into the image (2 per-run tool installs gone; versions now live in one tracked place). - Move api-docs (5s) and format (37s) to the idle 'small' lane — they were each queueing ~29min in the saturated ubuntu-latest lane. Also drops that lane from 5 jobs to 3. Only possible because container: makes them self-contained. Measured, not assumed: the image itself is worth only ~15-40s/job. The dominant costs are queue wait (server-management#604) and 742s of redundant compilation (#398) — both filed rather than silently bundled here. Refs #390
This commit is contained in:
@@ -25,7 +25,7 @@ name: Build ErsatzTV Image
|
||||
# cannot read the workflow `env` context. **Bump all five together**; see docs/ci-cd.md ->
|
||||
# "CI toolchain image" for the two-step procedure.
|
||||
#
|
||||
# CI image pin: 192.168.1.95:3000/timothy/ersatztv-ci:__CI_IMAGE_REF__
|
||||
# CI image pin: 192.168.1.95:3000/timothy/ersatztv-ci:6a9e27c
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
name: Build & test (.NET)
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: 192.168.1.95:3000/timothy/ersatztv-ci:__CI_IMAGE_REF__
|
||||
image: 192.168.1.95:3000/timothy/ersatztv-ci:6a9e27c
|
||||
credentials:
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
@@ -154,7 +154,7 @@ jobs:
|
||||
name: EF migration integrity (SQLite + MySql)
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: 192.168.1.95:3000/timothy/ersatztv-ci:__CI_IMAGE_REF__
|
||||
image: 192.168.1.95:3000/timothy/ersatztv-ci:6a9e27c
|
||||
credentials:
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
@@ -259,7 +259,7 @@ jobs:
|
||||
# Runs on PRs and on main (regression net); skipped for v* tag builds.
|
||||
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
|
||||
container:
|
||||
image: 192.168.1.95:3000/timothy/ersatztv-ci:__CI_IMAGE_REF__
|
||||
image: 192.168.1.95:3000/timothy/ersatztv-ci:6a9e27c
|
||||
credentials:
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
@@ -528,7 +528,7 @@ jobs:
|
||||
# `dotnet build`, so it is not always a "small" job; capacity 4 absorbs that.
|
||||
runs-on: small
|
||||
container:
|
||||
image: 192.168.1.95:3000/timothy/ersatztv-ci:__CI_IMAGE_REF__
|
||||
image: 192.168.1.95:3000/timothy/ersatztv-ci:6a9e27c
|
||||
credentials:
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
@@ -611,7 +611,7 @@ jobs:
|
||||
# `ubuntu-latest` lane. See the api-docs job above for the full rationale.
|
||||
runs-on: small
|
||||
container:
|
||||
image: 192.168.1.95:3000/timothy/ersatztv-ci:__CI_IMAGE_REF__
|
||||
image: 192.168.1.95:3000/timothy/ersatztv-ci:6a9e27c
|
||||
credentials:
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
+73
-1
@@ -90,6 +90,29 @@ jobs capped `--cpus=4 --memory=10g` so CI can't starve prod media playback), and
|
||||
runner task even when its `if` skips it, and those skip-tasks used to wait behind
|
||||
long builds (observed 31 min) stalling every PR run.
|
||||
|
||||
**Lane assignment (ersatztv#390).** The `ubuntu-latest` lane has **4 slots** (2 + 2) and the
|
||||
`small` lane has 4. A 2026-07-17 audit of the Actions API found the `ubuntu-latest` lane
|
||||
saturated and the `small` lane idle — **queue wait exceeded every job's runtime**:
|
||||
|
||||
| Job | Runtime | Queue wait | Lane |
|
||||
|---|---|---|---|
|
||||
| `test` | 354s | 1363s | ubuntu-latest |
|
||||
| `migrations` | 639s | 1428s | ubuntu-latest |
|
||||
| `functional-e2e` | 520s | 1447s | ubuntu-latest |
|
||||
| `api-docs` | 5s | **1722s** | ubuntu-latest → now `small` |
|
||||
| `format` | 37s | **1731s** | ubuntu-latest → now `small` |
|
||||
| `docs-reminder` / `decisions-guard` | 10s | **5s** | small |
|
||||
|
||||
So `api-docs` and `format` — genuinely small jobs — moved to `small`, which also drops the
|
||||
contended lane from 5 jobs to 3 and shortens the queue for the three heavy jobs. Both lanes run
|
||||
the *identical* `runner-images:ubuntu-latest` base, so `small` is a label with spare capacity, not
|
||||
a different capability. This move is only possible because those jobs now run in the **CI toolchain
|
||||
image** (below) and no longer need the runner image to supply .NET/Node. Caveat: on an
|
||||
API-touching PR `api-docs` does a full `dotnet build`, so it is not *always* small.
|
||||
|
||||
Queue wait is still the dominant cost and capacity is server-management's boundary — tracked in
|
||||
**server-management#604**. The redundant triple-build behind those runtimes is **ersatztv#398**.
|
||||
|
||||
### `test` job
|
||||
|
||||
`dotnet restore` → strip the Scanner project ref (`sed -i '/Scanner/d'`, matching the
|
||||
@@ -142,7 +165,8 @@ Boots the app **from source** and drives the manual live-E2E curl flows sessions
|
||||
re-run by hand, turning them into a CI regression net (ersatztv#299). It is the automatable half of
|
||||
`docs/e2e-local.md`; the two scripts it chains run identically locally and in CI:
|
||||
|
||||
1. `npm ci` + `npm run build` (SPA), `dotnet build ErsatzTV.sln -c Release`, ensure `ffmpeg` is on PATH.
|
||||
1. `npm ci` + `npm run build` (SPA), `dotnet build ErsatzTV.sln -c Release`. (ffmpeg comes from the
|
||||
CI toolchain image; the old `apt-get install ffmpeg` step is gone — see below.)
|
||||
2. `ETV_BUILD_CONFIG=Release scripts/e2e-local.sh <fresh-config>` — copies `wwwroot`, launches
|
||||
`dotnet ErsatzTV.dll` in the background (logging to a file so the launch step returns once the app
|
||||
is ready), prints `PID`/`CONFIG_DIR`.
|
||||
@@ -191,6 +215,54 @@ accepts the token in *any* commit of the range). The local hook is therefore the
|
||||
gate; CI is the backstop for direct pushes or bypassed hooks. Like `docs-reminder`, it's a
|
||||
seconds-long `git diff` with no dotnet/node setup (`runs-on: small`).
|
||||
|
||||
## CI toolchain image (`docker/ci/Dockerfile`, `.gitea/workflows/ci-image.yml`)
|
||||
|
||||
The jobs that need a toolchain — `test`, `migrations`, `functional-e2e`, `api-docs`, `format` —
|
||||
run **inside** a shared image via `container:` instead of installing their toolchain per run
|
||||
(ersatztv#390). They therefore carry **no** `setup-dotnet`, **no** `setup-node`, **no** `apt-get`,
|
||||
and **no** `dotnet tool install`.
|
||||
|
||||
**What it ships:** .NET 10 SDK, Node 22, prod-identical ffmpeg/ffprobe, `git`/`python3`/`jq`/`zstd`,
|
||||
and the `dotnet-ef` + `dotnet-reportgenerator-globaltool` global tools (which the `migrations` and
|
||||
`test` jobs used to install on every run — **bump those versions in the Dockerfile, not the
|
||||
workflow**). Project dependencies (NuGet/npm) are deliberately **not** baked in — they change per
|
||||
commit and stay on `actions/cache` (`~/.nuget/packages`, `~/.npm`).
|
||||
|
||||
**How it's layered:** `FROM ersatztv-ffmpeg:8.1.2` + `COPY --from=mcr.microsoft.com/dotnet/sdk:10.0-noble-amd64
|
||||
/usr/share/dotnet` — the same pattern `docker/Dockerfile` uses for the prod image. Our ffmpeg base is
|
||||
`ghcr.io/linuxserver/baseimage-ubuntu:noble`, the same Ubuntu release as the SDK image, so the copied
|
||||
SDK matches the base's glibc/ICU. Keep `FFMPEG_TAG` equal to the tag `docker/Dockerfile` pins, so CI's
|
||||
ffmpeg stays prod-identical — that fidelity is what the ersatztv#299 seeded-media/scanner E2E
|
||||
follow-ups will need.
|
||||
|
||||
**Bumping the toolchain is a deliberate two-step.** The jobs pin an immutable `:<sha>`, never
|
||||
`:latest`, so a bad toolchain push cannot break every job at once:
|
||||
|
||||
1. Merge a `docker/ci/Dockerfile` change. `ci-image.yml` publishes `ersatztv-ci:<sha>` (+ `:latest`
|
||||
from `main` only — a human pointer; **jobs must never consume it**).
|
||||
2. In a follow-up PR, update the pin in `docker-build.yml` — **all five jobs together**. That PR's own
|
||||
CI is what proves the new image works. The pin is repeated per job because
|
||||
`jobs.<id>.container.image` cannot read the workflow `env` context.
|
||||
|
||||
`ci-image.yml` triggers on pushes touching `docker/ci/**`, `workflow_dispatch`, and a weekly Monday
|
||||
05:00 UTC cron (base-image security updates; Gitea registers `schedule` only from `main`). It runs on
|
||||
the `small` lane and, like `docker-build.yml`, needs BuildKit's inline `http = true` for the HTTP
|
||||
registry. Renovate tracks the Dockerfile's image pins (`dockerfile` manager, see `renovate.json`).
|
||||
|
||||
**Two container-specific gotchas**, both handled in the Dockerfile — worth knowing if you add a job:
|
||||
- `actions/checkout` clones as root into a mounted workspace, which trips git's *"detected dubious
|
||||
ownership"* guard and breaks every `git` call in a step. Fixed with `git config --global --add
|
||||
safe.directory '*'`.
|
||||
- The ffmpeg base sets `ENTRYPOINT ["ffmpeg"]` because it ships as an ffmpeg CLI. A job container is
|
||||
started long-lived with steps exec'd into it, so both `ENTRYPOINT` and `CMD` are reset.
|
||||
|
||||
**What it is and isn't worth.** Measured honestly (ersatztv#390): the image saves ~15–40s per job
|
||||
(`setup-dotnet` is 8–19s, `setup-node` 2–5s cached, the two tool installs ~9s) plus the 110s
|
||||
apt-ffmpeg step — roughly 3–8% of runtime. It is **not** where CI time goes; see the lane table above
|
||||
(queue wait, server-management#604) and ersatztv#398 (742s of redundant compilation). Its durable
|
||||
value is prod-identical ffmpeg, a pinned/consistent toolchain, and making jobs runner-agnostic — the
|
||||
last is what allowed the lane rebalance.
|
||||
|
||||
## Dockerfile notes (`docker/Dockerfile`)
|
||||
|
||||
- Base image: **`192.168.1.95:3000/timothy/ersatztv-ffmpeg:8.1.2`** (our Gitea fork of
|
||||
|
||||
Reference in New Issue
Block a user