# Woodpecker CI (server + agent) Self-hosted CI for the co-op's repos. **As of 2026-11-20 tests are ADVISORY, not a merge gate** — `co-op/docs` (manual, build+deploy), `code/member-portal`, `code/admin-panel` and `code/member-dashboard` (push-triggered test runs). Read the *Current state* section for what is proven and the traps that remain. Two Cloudron apps, added 2026-11-03: | App | FQDN | Cloudron id | Image | |---|---|---|---| | Woodpecker **server** | `ci.inference.coop` | `4984f95e-0c0a-4af3-9ce1-4ca4f3e8483d` | `cloudron/org.woodpecker_ci.cloudronapp:202610300219490000` (store, v2.22.1 / upstream 3.20.1) | | Woodpecker **agent** | `ci-agent.inference.coop` | `5ac63873-cf2c-4ad9-acd6-81dc0e016c83` | `registry.inference.coop/co-op/woodpecker-agent:20261104-e070275` (**custom**) | - The **server** is the stock Cloudron app. It uses the `mysql` addon for storage and exposes `GRPC_PORT` 9000 to the agent. Its config lives in `/app/data/env.sh` (`WOODPECKER_GITEA`, `WOODPECKER_ADMIN`, `WOODPECKER_AGENT_SECRET`, `WOODPECKER_OPEN`, …). **No env vars are set through the app's Cloudron env** (`env-keys` is empty) — everything is in that file. - The **agent** is a custom app. Its config is set as Cloudron env (names only): `WOODPECKER_SERVER` = `ci.inference.coop:9000`, `WOODPECKER_GRPC_SECURE=true`, `WOODPECKER_BACKEND=local`, `WOODPECKER_MAX_WORKFLOWS=2`, `WOODPECKER_AGENT_CONFIG_FILE=/app/data/agent.conf`, plus the shared `WOODPECKER_AGENT_SECRET`. ## Why the agent image is custom (and why the backend is `local`) Cloudron apps have **no Docker socket**, so the default `docker` backend cannot run and the agent uses the **`local` backend**: each pipeline step executes as a shell command *inside the agent container*, and a step's `image:` field selects the **shell**, not a container image. Consequence: **every tool a pipeline step needs must be baked into the agent image**, and the Cloudron rootfs is read-only at run time, so nothing can install at run time. The image is `FROM woodpeckerci/woodpecker-agent:v3.20.1-alpine` (the **alpine** variant — the default `scratch` image has no shell). It adds `bash`, `git`, **`git-lfs`**, `tar`, `ca-certificates`, `python3`, `node`/`npm`, the `cloudron` CLI, and a pinned MkDocs toolchain at `/opt/docs-venv`. It **runs as root** (`/app/data` on this Cloudron is root-owned, as for the other custom apps here). ## Building and pinning the agent image - **Source repo:** `/home/ubuntu/repos/woodpecker-agent` on the agent host. ⚠️ **This repo has no git remote and has never been pushed to Gitea** — the CI agent's build source exists only on the agent host. Treat that as a gap to close. - **Tag convention:** `-` (e.g. `20261104-e070275`). Never a floating tag. - **Build:** `~/.hermes/scripts/cloudron_builder_build.sh registry.inference.coop/co-op/woodpecker-agent ` (the script carries the registry auth triple, which is not optional). - **Deploy:** write the new tag into `CloudronManifest.json`'s `dockerImage`, commit, build `--no-cache`, then `cloudron update --app 5ac63873-…` **without** `--image` (the manifest's pin wins). Verify by the running image tag **and** something only the new build produces — never by exit code alone. - `publishing-requirements.txt` mirrors the docs repo's `publishing/requirements.txt`; **keep the two in step** when the docs toolchain changes. ## Current state (2026-11-11): push-gated test CI is live - **The server-side gRPC 500 was never the blocker.** The agent's `Next` long-poll is cut short by the platform proxy every ~10 minutes (nginx `upstream timed out`, `could not find named location "@grpc_unavailable"`) and the agent retries — pipelines are collected and executed regardless. Re-confirmed 2026-11-11: the 500s continue in the log while push-triggered pipelines run green. Do not chase it. - **API access:** a personal token for `inference-admin` lives at `/home/ubuntu/.hermes/woodpecker.key` (mode 600). Repo enablement is `POST /api/repos?forge_remote_id=` (query param, not body); a manual run is `POST /api/repos//pipelines` with `{"branch": "..."}`. - **Enabled repos:** `co-op/docs` (id 1), `code/member-portal` (id 2), `code/admin-panel` (id 3), `code/member-dashboard` (id 4, enabled 2026-11-13 with the same push gate + `ci/woodpecker/push/woodpecker` status check as the panel). Note `co-op/member-portal` is a Gitea REDIRECT to `code/member-portal` — the canonical repo lives in the `code` org (Gitea id 6). - **Test runs are ADVISORY, not a merge gate (changed 2026-11-20):** `.woodpecker.yml` on the apps' default branches runs the existing suites on every push (portal test files; admin-panel guest-guard + oidc/chart sync pins + 4 page-JS harnesses; member-dashboard oidc/chart sync pins + 2 page-JS harnesses). Branch protection no longer requires the `ci/woodpecker/push/woodpecker` status context: the runner shares one root container, so a pipeline can forge statuses. Owners review is the trust boundary; CI failures are visible but do not block a reviewed merge. Do not turn the status requirement back on until pipelines are isolated. - **Shared chart module (added 2026-11-13):** `ops-docs/scripts/shared/ coop_chart.js` is the canonical chart rendering + hover-tooltip module; byte-identical copies live at `app/coop_chart.js` in both UI apps, spliced into each PAGE_HTML at import time. `tests/test_chart_sync.py` in each app pins the copy (same pattern as the oidc client); `scripts/check-chart-sync.py` is the pre-deploy gate and `scripts/sync-chart-module.sh` re-copies + re-pins both apps in one step. Since 2026-11-13 the module ALSO owns the chart DEFINITIONS (`CHART_METRICS` + `renderChart()`): one description per chart, read by both UIs, so the metric list, the titles, the axis rules and the formatters cannot drift apart again. Each app keeps only `METRIC_SOURCE` (which fetch feeds a metric) and its own DOM; Money is a metric of Trends in both, not a tab. The vendored `tests/check-page-js.sh` in BOTH apps splices the module into the extracted page JS exactly as the app does — keep the two vendored copies byte-identical to the skill's script (md5 445cdcf59f193ff875bb634f6f790e73). - **Proven with real output:** first push runs green (portal tests step: 439 log lines ending "all portal test suites green"; all four harnesses OK on the panel), and a deliberately broken assertion on a branch (`ci-red-test`) produced pipeline #2 **failure** with the failing status context on Gitea — the gate signal works. The branch was deleted after the proof. - **The agent's python is 3.14** (agent image base) — the portal's PINNED requirements (pydantic 2.9.2, psycopg2-binary 2.9.9) have no cp314 wheels, so the portal pipeline installs a bounded-range subset (fastapi/httpx/PyJWT/ slowapi/cryptography) instead of `-r requirements.txt`. See `code/member-portal/.woodpecker.yml` for the rationale. ## When a pipeline runs (and when it does not) - `co-op/docs`: **manual-trigger only** by deliberate decision (the poll watcher remains the live auto-deploy path until the operator says otherwise). - `code/member-portal`, `code/admin-panel`: fire on every **push** (any branch) and can also be triggered manually. - **`git-lfs` is required by the clone step.** Woodpecker runs `git lfs fetch` after cloning, so a clone step fails with `git: 'lfs' is not a git command` on any image without it — this was added to the agent image on 2026-11-04. If a rebuild ever drops it, clones break again. ## Historical state (2026-11-04): installed, agent connected, could not run jobs Superseded by the section above. Kept because each entry was a lesson: the health endpoint lied by omission (liveness, not capability), the missing git-lfs broke every clone, the missing repo secret (`cloudron_token`) made the config fail to PARSE with the reason visible ONLY in the web UI, and the gRPC 500s were misread twice as the blocker before pipeline #2 proved otherwise. The repo-enablement login gate (operator completes Gitea OAuth once) was cleared the same day: the `inference-admin` user exists with admin rights. ## Enabling a repo (known gate — cleared 2026-11-04) - Repos are connected through the **Gitea** source (`WOODPECKER_GITEA`). The OAuth login source was stood up by the operator and the `inference-admin` user exists (admin). Enabling further repos is now a pure API call (see *Current state*), not an operator step. - Reading run/pipeline state is done from the server's **MySQL** database, not from a public API, when the API view is thin (the pipeline endpoint does not expose step logs; `log_entries` in the database does). - Note: the whole point of this CI is to take the docs build and custom-app builds off the agent host — see `co-op/support#30` (moving `REGISTRY_BUILD_TOKEN` to CI).