From 2fad8db639e2d23bcbb82f518b4d7b241b092549 Mon Sep 17 00:00:00 2001 From: Erich Blume Date: Fri, 13 Feb 2026 10:20:27 -0800 Subject: [PATCH] Add yq to forgejo-runner and replace sed YAML edits (#180) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Install yq in the forgejo-runner container image for structured YAML editing - Replace fragile `sed` regex patterns with `yq` in `build-blumeops.yaml` and `cv-deploy.yaml` workflows ## Deployment 1. Merge this PR 2. Tag and release forgejo-runner v3.1.0: `mise run container-tag-and-release forgejo-runner v3.1.0` 3. Update runner label in `argocd/manifests/forgejo-runner/external-secret.yaml` from `v3.0.2` to `v3.1.0` 4. Sync the forgejo-runner app: `argocd app sync forgejo-runner` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: https://forge.ops.eblu.me/eblume/blumeops/pulls/180 --- .forgejo/workflows/build-blumeops.yaml | 2 +- .forgejo/workflows/cv-deploy.yaml | 2 +- containers/forgejo-runner/Dockerfile | 9 ++++++++- docs/changelog.d/feature-yq-in-runner.infra.md | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 docs/changelog.d/feature-yq-in-runner.infra.md diff --git a/.forgejo/workflows/build-blumeops.yaml b/.forgejo/workflows/build-blumeops.yaml index 754f52a..dca745a 100644 --- a/.forgejo/workflows/build-blumeops.yaml +++ b/.forgejo/workflows/build-blumeops.yaml @@ -234,7 +234,7 @@ jobs: RELEASE_URL="https://forge.ops.eblu.me/eblume/blumeops/releases/download/${VERSION}/${TARBALL}" echo "Updating $DEPLOYMENT_FILE with new release URL..." - sed -i "s|value: \"https://forge.ops.eblu.me/eblume/blumeops/releases/download/[^\"]*\"|value: \"${RELEASE_URL}\"|" "$DEPLOYMENT_FILE" + yq -i "(.spec.template.spec.containers[0].env[] | select(.name == \"DOCS_RELEASE_URL\")).value = \"${RELEASE_URL}\"" "$DEPLOYMENT_FILE" echo "Updated deployment:" grep -A1 "DOCS_RELEASE_URL" "$DEPLOYMENT_FILE" diff --git a/.forgejo/workflows/cv-deploy.yaml b/.forgejo/workflows/cv-deploy.yaml index 553185c..d2314c9 100644 --- a/.forgejo/workflows/cv-deploy.yaml +++ b/.forgejo/workflows/cv-deploy.yaml @@ -68,7 +68,7 @@ jobs: RELEASE_URL="https://forge.ops.eblu.me/api/packages/eblume/generic/cv/${VERSION}/${TARBALL}" echo "Updating $DEPLOYMENT_FILE with CV_RELEASE_URL..." - sed -i "s|value: \"https://forge.ops.eblu.me/api/packages/eblume/generic/cv/[^\"]*\"|value: \"${RELEASE_URL}\"|" "$DEPLOYMENT_FILE" + yq -i "(.spec.template.spec.containers[0].env[] | select(.name == \"CV_RELEASE_URL\")).value = \"${RELEASE_URL}\"" "$DEPLOYMENT_FILE" echo "Updated deployment:" grep -A1 "CV_RELEASE_URL" "$DEPLOYMENT_FILE" diff --git a/containers/forgejo-runner/Dockerfile b/containers/forgejo-runner/Dockerfile index e333401..2adaf42 100644 --- a/containers/forgejo-runner/Dockerfile +++ b/containers/forgejo-runner/Dockerfile @@ -4,7 +4,7 @@ # The host runner daemon creates containers from this image to run workflow steps. # # Build logic (container images, docs site) runs inside Dagger containers, -# so this image only needs: git, Docker CLI, Dagger CLI, ArgoCD CLI, uv, and basic tools. +# so this image only needs: git, Docker CLI, Dagger CLI, ArgoCD CLI, uv, yq, and basic tools. # # Usage: Configure runner with label like: # docker:docker://registry.ops.eblu.me/blumeops/forgejo-runner:latest @@ -59,6 +59,13 @@ RUN ARCH="${TARGETARCH:-$(dpkg --print-architecture)}" \ && rm /tmp/dagger.tar.gz \ && dagger version +# Install yq (for editing YAML files in workflows) +RUN ARCH="${TARGETARCH:-$(dpkg --print-architecture)}" \ + && curl -fsSL -o /usr/local/bin/yq \ + "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${ARCH}" \ + && chmod +x /usr/local/bin/yq \ + && yq --version + # Install flyctl (for Fly.io cache purge after docs deploy) RUN curl -L https://fly.io/install.sh | sh \ && mv /root/.fly/bin/flyctl /usr/local/bin/fly \ diff --git a/docs/changelog.d/feature-yq-in-runner.infra.md b/docs/changelog.d/feature-yq-in-runner.infra.md new file mode 100644 index 0000000..4856768 --- /dev/null +++ b/docs/changelog.d/feature-yq-in-runner.infra.md @@ -0,0 +1 @@ +Add yq to forgejo-runner container and replace sed-based YAML editing in workflows with yq