From d8d29664a3dc9648bf6b496d0ea84b0a47792ad8 Mon Sep 17 00:00:00 2001 From: Mathias Date: Tue, 25 Aug 2026 17:25:24 +0200 Subject: [PATCH] ci(deploy): refuse to patch a manifest with an empty IMAGE_TAG (infra#311) On 2026-08-25 a deploy job ran with an empty IMAGE_TAG, wrote `image: localhost:5000/gitea-mcp:` into the infra repo and pushed it. That is invalid YAML, so Flux failed the ENTIRE apps Kustomization -- every app stopped reconciling for about an hour, including three unrelated deploys queued behind it. This job's existing check could not catch it. It greps for `image: :${IMAGE_TAG}` after the sed, and with IMAGE_TAG empty that pattern matches the corrupted line itself, so the verification passes because of the bug rather than despite it. Asserting the input up front is the fix: an empty tag now fails the job before anything is written, let alone committed. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_011PL5XcG68SvQqz3vGVbWbf --- .gitea/workflows/cd.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitea/workflows/cd.yml b/.gitea/workflows/cd.yml index f92e437..6cb8d27 100644 --- a/.gitea/workflows/cd.yml +++ b/.gitea/workflows/cd.yml @@ -90,6 +90,13 @@ jobs: DEPLOY_KEY: ${{ secrets.INFRA_DEPLOY_KEY }} run: | set -euo pipefail + # infra#311: fail on an empty tag BEFORE patching anything. The + # grep verification further down CANNOT catch it -- with IMAGE_TAG + # empty its pattern matches the very corruption it exists to reject. + # The result is `image: :` in the manifest, which is invalid + # YAML, so Flux fails the ENTIRE apps Kustomization and every app + # stops reconciling, not just this one. That happened on 2026-08-25. + [ -n "${IMAGE_TAG:-}" ] || { echo "IMAGE_TAG is empty - refusing to patch"; exit 1; } mkdir -p ~/.ssh echo "$DEPLOY_KEY" > ~/.ssh/id_infra chmod 600 ~/.ssh/id_infra