No description
  • Shell 73.3%
  • Dockerfile 13.7%
  • Makefile 13%
Find a file
Yippee cf8974f569
All checks were successful
self-test / verify-1 (push) Successful in 5s
self-test / verify (push) Successful in 0s
docs: PR jobs run in node:22-trixie
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 00:32:25 +02:00
.forgejo/workflows docs: PR jobs run in node:22-trixie 2026-11-29 00:32:25 +02:00
actions/gitops-bump Shared CI/CD: reusable verify/release workflows and gitops-bump 2026-11-28 19:48:11 +02:00
images/ci-builder Runners move to k8s: release.yml runs on release, ci-builder image 2026-11-28 20:26:50 +02:00
Makefile Runners move to k8s: release.yml runs on release, ci-builder image 2026-11-28 20:26:50 +02:00
README.md docs: PR jobs run in node:22-trixie 2026-11-29 00:32:25 +02:00

infra/ci

One shared CI/CD pipeline for every repo on git.yippee.com.

PR ──► verify.yml  (runner: pr, container, unprivileged, no secrets)  ──► make ci
push to default branch ──► release.yml (runner: release, ci-builder container + dind)
                             ├─ build:  make ci → docker login → make release → Harbor sha-<12>
                             └─ deploy: gitops-bump → commit "deploy <app> sha-<12>" to yippee/k8s-gitops
                                                         └─► ArgoCD auto-sync
v* tag ──► release.yml build only (Harbor gets sha-<12> + v*), no deploy

The contract a repo must meet

target required does
make ci always every PR check (vet, tests, lint, frontend build). Must pass as a non-root user inside node:22-trixie (Debian 13, like the workstation) with Go from setup-go.
make release if it ships an image test, docker buildx build --push to $(IMAGE):$(TAG), with TAG ?= sha-$(git rev-parse --short=12 HEAD). It must accept IMAGE= and TAG= overrides. Copy release / release-builder from projects/yvp/Makefile.

The image line in the gitops manifest must be image: <image>:<tag> on one line.

Onboarding a repo

A repo that deploys gets two workflow files, one per trigger:

.forgejo/workflows/ci.yml:

name: ci
on:
  pull_request:
jobs:
  verify:
    uses: infra/ci/.forgejo/workflows/verify.yml@v1

.forgejo/workflows/release.yml:

name: release
on:
  push:
    branches: [master]
    tags: ["v*"]
jobs:
  release:
    uses: infra/ci/.forgejo/workflows/release.yml@v1
    with:
      image: harbor.yippee.com/yippee/<app>
      go-version-file: go.mod        # backend/go.mod for yvp/twco
      gitops-file: gitops/services/<app>/deployment.yaml
    secrets: inherit

A repo that only verifies needs just ci.yml, triggered on pull_request and push to the default branch.

Never gate a uses: job on github.event_name. Forgejo copies the caller's if: into the expanded job, where event_name is workflow_call. A job gated on pull_request is then skipped, and Forgejo reports the skipped job as a green check. Pick the event with on: (one file per trigger). Inside these workflows, guards test github.ref, which survives expansion.

This repo and the infra org must be public. Forgejo expands infra/ci/...@v1 into real jobs only for a public repo in a visible org. Otherwise the run fails at 0s with "failed to access user infra". A full https:// URL is never expanded: the caller job then waits forever for a runner that doesn't exist.

verify.yml inputs

input default
go-version-file go.mod '' skips Go setup
node-version '' '' uses the image's node 22
make-target ci
make-args '' e.g. GOTEST_FLAGS=-v

release.yml inputs

input default
image required without tag
test-target ci runs as its own step before the build
gitops-file '' '' = build and push only, no deploy

Secrets

Set them once at owner level (Forgejo → user or org Settings → Actions → Secrets). secrets: inherit passes them to the job:

secret what
HARBOR_ROBOT_USER / HARBOR_ROBOT_SECRET Harbor robot account with push rights on the project
GITOPS_TOKEN token of the ci-bot Forgejo user, which has write on yippee/k8s-gitops only

Needed on: the yippee user (twco, yvp) and the projects org.

Runners

The runners run in k8s. They're managed by ArgoCD from k8s-gitops gitops/platform/forgejo-runner/:

runner label runs why
runner-pr (Deployment) pr:docker://node:22-trixie verify.yml Untrusted PR code: its own dind and no Docker socket in jobs. It gets no secrets.
runner-release (StatefulSet) release:docker://harbor.yippee.com/library/ci-builder:<tag> release.yml, builder.yml Trusted refs only. Jobs get the pod's dind socket, which has a persistent layer cache (30Gi PVC). It runs arm64 emulation through binfmt.

Each pod is the runner plus a privileged docker:dind sidecar, reachable only on a pod-local Unix socket. Job containers trust the homelab CA through a mounted bundle, and they resolve *.yippee.com through CoreDNS (make coredns-hosts in k8s-gitops).

  • Registration: make runners-register in k8s-gitops, with RUNNER_SECRET_* in ~/Workspace/.env.
  • Job image: images/ci-builder is the release job image. builder.yml rebuilds it; for the very first image, run make builder-image from a workstation.
  • Logs: Forgejo keeps job logs at /data/actions_log/<owner>/<repo>/<NN>/<task>.log.zst in the forgejo pod. The API doesn't serve them.

verify.yml refuses to run outside a container as a backstop.

Versioning

Callers pin @v1. For a compatible change, move the tag: git tag -f v1 && git push -f origin v1. For a breaking change, cut v2 and migrate callers.

Local checks

make ci runs the offline test for gitops-bump against a throwaway bare repo. The test covers the exact-line match, idempotence, a missing image, and a concurrent push.