From e790aec84eacf4edb1707831056d18e5cd40da8a Mon Sep 17 00:00:00 2001 From: Erich Blume Date: Fri, 13 Feb 2026 10:16:50 -0800 Subject: [PATCH] Add yq to forgejo-runner and replace sed YAML edits in workflows Install yq in the runner container image so workflows can use it for structured YAML editing instead of fragile sed regex patterns. Co-Authored-By: Claude Opus 4.6 --- .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