From 12d83baa61ed1d000a5ce2136140e6ea98692b4b Mon Sep 17 00:00:00 2001 From: Erich Blume Date: Tue, 14 Apr 2026 09:30:43 -0700 Subject: [PATCH 1/2] Build forgejo-runner container locally via native Dagger pipeline Replace upstream code.forgejo.org/forgejo/runner image with a locally built container using the container.py pattern (Go + Alpine runtime). Kustomization tag is a placeholder until CI builds the image. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../forgejo-runner/kustomization.yaml | 3 +- containers/forgejo-runner/container.py | 67 +++++++++++++++++++ .../changelog.d/local-forgejo-runner.infra.md | 1 + 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 containers/forgejo-runner/container.py create mode 100644 docs/changelog.d/local-forgejo-runner.infra.md diff --git a/argocd/manifests/forgejo-runner/kustomization.yaml b/argocd/manifests/forgejo-runner/kustomization.yaml index 2c845ee..8b9ee03 100644 --- a/argocd/manifests/forgejo-runner/kustomization.yaml +++ b/argocd/manifests/forgejo-runner/kustomization.yaml @@ -10,7 +10,8 @@ resources: images: - name: code.forgejo.org/forgejo/runner - newTag: "12.7.3" + newName: registry.ops.eblu.me/blumeops/forgejo-runner + newTag: "kustomized" - name: docker newTag: 27-dind diff --git a/containers/forgejo-runner/container.py b/containers/forgejo-runner/container.py new file mode 100644 index 0000000..16f6986 --- /dev/null +++ b/containers/forgejo-runner/container.py @@ -0,0 +1,67 @@ +"""Forgejo Runner — native Dagger build. + +Two-stage build: Go (static binary with CGO for SQLite), Alpine (runtime). +Source cloned from forge mirror. +""" + +import dagger +from dagger import dag + +from blumeops.containers import ( + alpine_runtime, + clone_from_forge, + oci_labels, +) + +VERSION = "12.7.3" + + +async def build(src: dagger.Directory) -> dagger.Container: + source = clone_from_forge("forgejo-runner", f"v{VERSION}") + + # Stage 1: Build Go binary (static, CGO enabled for SQLite) + ldflags = ( + '-extldflags "-static" -s -w' + f' -X "code.forgejo.org/forgejo/runner/v12/internal/pkg/ver.version=v{VERSION}"' + ) + backend = ( + dag.container() + .from_("golang:alpine3.22") + .with_exec(["apk", "add", "--no-cache", "build-base", "git"]) + .with_directory("/app", source) + .with_workdir("/app") + .with_env_variable("CGO_ENABLED", "1") + .with_env_variable("CGO_CFLAGS", "-DSQLITE_MAX_VARIABLE_NUMBER=32766") + .with_exec( + [ + "go", + "build", + "-tags=netgo osusergo", + f"-ldflags={ldflags}", + "-o", + "/forgejo-runner", + ".", + ] + ) + ) + + # Stage 2: Runtime + runtime = alpine_runtime( + extra_apk=["git", "bash", "ca-certificates"], + uid=1000, + gid=1000, + username="runner", + ) + runtime = oci_labels( + runtime, + title="Forgejo Runner", + description="A runner for Forgejo Actions", + version=VERSION, + ) + return ( + runtime.with_file("/bin/forgejo-runner", backend.file("/forgejo-runner")) + .with_env_variable("HOME", "/data") + .with_user("1000:1000") + .with_workdir("/data") + .with_default_args(args=["/bin/forgejo-runner"]) + ) diff --git a/docs/changelog.d/local-forgejo-runner.infra.md b/docs/changelog.d/local-forgejo-runner.infra.md new file mode 100644 index 0000000..ffef62e --- /dev/null +++ b/docs/changelog.d/local-forgejo-runner.infra.md @@ -0,0 +1 @@ +Build forgejo-runner container locally via native Dagger pipeline instead of pulling from upstream. From 36ae1e99cacadbf63c04d12cf0d3c8c9d6b04c8d Mon Sep 17 00:00:00 2001 From: Erich Blume Date: Tue, 14 Apr 2026 10:49:44 -0700 Subject: [PATCH 2/2] Set forgejo-runner kustomization tag to branch-built image Co-Authored-By: Claude Opus 4.6 (1M context) --- argocd/manifests/forgejo-runner/kustomization.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/argocd/manifests/forgejo-runner/kustomization.yaml b/argocd/manifests/forgejo-runner/kustomization.yaml index 8b9ee03..b652821 100644 --- a/argocd/manifests/forgejo-runner/kustomization.yaml +++ b/argocd/manifests/forgejo-runner/kustomization.yaml @@ -11,7 +11,7 @@ resources: images: - name: code.forgejo.org/forgejo/runner newName: registry.ops.eblu.me/blumeops/forgejo-runner - newTag: "kustomized" + newTag: v12.7.3-12d83ba - name: docker newTag: 27-dind