fix: use proper language images for runner labels, not bare Alpine
Build and push runner images / build-runners (pull_request) Failing after 38s

ROOT CAUSE: All 3 runner labels pointed to code.forgejo.org/forgejo/runner:6
(bare Alpine). When Forgejo runs a workflow, it creates a container FROM the
label image — this container had no Node.js, no docker CLI, no Go/Rust,
no root access, and no apt-get. Every CI job failed.

FIX: Change runner labels to official Debian-based language images:
  golang → docker://golang:1.26-bookworm (Go + apt-get + root)
  node   → docker://node:22-bookworm (Node.js + npm + apt-get + root)
  rust   → docker://rust:1-bookworm (Rust + cargo + apt-get + root)

The runner daemon pod still uses forgejo/runner:6 — only the label image
(what workflow steps execute in) changes.

Unified CI pattern for ALL repos:
1. Install Node.js first if not present (needed for actions/checkout@v4)
2. Install docker.io via apt-get (needed for docker build/push)
3. Use actions/checkout@v4 normally
4. Build/push with docker

IMPORTANT: Runners must re-register after merge. Delete PVCs or
/data/.runner files to trigger re-registration with new labels.
This commit is contained in:
2026-09-06 07:06:44 -07:00
parent dade5f77ae
commit 4e9484bdf8
4 changed files with 23 additions and 15 deletions
+12 -7
View File
@@ -18,13 +18,16 @@ on:
jobs:
build-runners:
runs-on: golang
env:
REGISTRY: forgejo.riotpiao.com
IMAGE_BASE: forgejo.riotpiao.com/rock
# Unified CI pattern: golang label → golang:1.26-bookworm (Debian, root, apt-get)
# Install Node.js + docker in steps. actions/checkout@v4 needs Node.js.
steps:
- name: Clone repository
- name: Install dependencies
run: |
git clone --depth 1 https://forgejo.riotpiao.com/rock/homelab.git .
apt-get update
apt-get install -y --no-install-recommends nodejs docker.io
rm -rf /var/lib/apt/lists/*
- uses: actions/checkout@v4
- name: Get commit SHA
id: sha
@@ -32,7 +35,7 @@ jobs:
SHORT_SHA=$(git rev-parse --short HEAD)
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
- name: Build all runner images (test on PR, push on main)
- name: Build all runner images
run: |
set -e
for RUNNER in golang rust node; do
@@ -50,7 +53,6 @@ jobs:
echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" \
--username "${REGISTRY_USER}" --password-stdin
for RUNNER in golang rust node; do
echo "📤 Pushing ${RUNNER}-runner:${{ steps.sha.outputs.short_sha }}"
docker push "${IMAGE_BASE}/forgejo-runner-${RUNNER}:${{ steps.sha.outputs.short_sha }}"
docker push "${IMAGE_BASE}/forgejo-runner-${RUNNER}:latest"
echo "✅ Pushed ${RUNNER}-runner"
@@ -58,3 +60,6 @@ jobs:
env:
REGISTRY_USER: ${{ secrets.FORGEJO_REGISTRY_USER }}
REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}
env:
REGISTRY: forgejo.riotpiao.com
IMAGE_BASE: forgejo.riotpiao.com/rock
+3 -4
View File
@@ -2,15 +2,14 @@
# runner instance. Only runner.name and runner.labels differ -- everything
# else (image, dind, persistence, tolerations, nodeSelector) is shared.
#
# node:22-bookworm ships Node natively. Docker client installed via workflow step if needed.
# (homelab has no CI; custom runner images built manually if desired)
# Bootstrap with runner image (already has Node.js), CI builds custom
# Label image: node:22-bookworm — Debian, root, apt-get, Node.js, npm, git.
# Install docker in workflow steps as needed.
runner:
image:
repository: code.forgejo.org/forgejo/runner
tag: "6"
name: node-runner
labels: "node:docker://code.forgejo.org/forgejo/runner:6"
labels: "node:docker://node:22-bookworm"
# GC CronJob renders only from the default (golang) values to avoid duplicates
gc:
+3 -2
View File
@@ -2,13 +2,14 @@
# runner instance. Only runner.name and runner.labels differ -- everything
# else (image, dind, persistence, tolerations, nodeSelector) is shared.
#
# Bootstrap with runner image, CI builds custom with Node.js+Rust
# Label image: rust:1-bookworm — Debian, root, apt-get, Rust, cargo, git.
# Install Node.js/docker in workflow steps as needed.
runner:
image:
repository: code.forgejo.org/forgejo/runner
tag: "6"
name: rust-runner
labels: "rust:docker://code.forgejo.org/forgejo/runner:6"
labels: "rust:docker://rust:1-bookworm"
+5 -2
View File
@@ -1,9 +1,12 @@
runner:
image:
repository: code.forgejo.org/forgejo/runner
tag: "6" # Bootstrap with runner image, CI builds custom with Node.js
tag: "6"
name: golang-runner
labels: "golang:docker://code.forgejo.org/forgejo/runner:6"
# Label image is what workflow steps run in (NOT the runner daemon image).
# golang:1.26-bookworm: Debian, root, apt-get, Go, git.
# Install Node.js/docker in workflow steps as needed.
labels: "golang:docker://golang:1.26-bookworm"
forgejoUrl: http://forgejo-gitea-http.cicd.svc.cluster.local:3000
tokenSecret: runner-token
resources: