From 146f4c58683f4ab12169d2ca9f8489f6f770ad42 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Thu, 3 Dec 2026 17:26:00 +1300 Subject: [PATCH] CI deploys the app: set_digests.py rewrites visualci-app's digest, not visualci-server's (sc-8900 cutover) --- .github/workflows/ci.yml | 4 ++-- scripts/ci/set_digests.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a049f76d..76d33968 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -410,7 +410,7 @@ jobs: runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }} timeout-minutes: 5 env: - SERVER_DIGEST: ${{ needs.images.outputs.server }} + APP_DIGEST: ${{ needs.images.outputs.app }} RENDERER_DIGEST: ${{ needs.images.outputs.renderer }} KUSTOMIZATION: infra/k3s/resources/visualci/kustomization.yaml steps: @@ -444,7 +444,7 @@ jobs: echo "::notice::Not deployed: production runs $deployed, which this commit doesn't come after"; exit 0 fi for _ in 1 2 3 4 5; do - python3 scripts/ci/set_digests.py "$KUSTOMIZATION" "$GITHUB_SHA" "$SERVER_DIGEST" "$RENDERER_DIGEST" + python3 scripts/ci/set_digests.py "$KUSTOMIZATION" "$GITHUB_SHA" "$APP_DIGEST" "$RENDERER_DIGEST" git -C infra commit -qam "visualci: deploy ${GITHUB_SHA::12}" -m "$(git log -1 --format=%s "$GITHUB_SHA" | cut -c1-120)" if git -C infra push -q origin HEAD:main; then exit 0; fi git -C infra fetch -q origin main && git -C infra reset -q --hard origin/main diff --git a/scripts/ci/set_digests.py b/scripts/ci/set_digests.py index 90395570..1feaa69b 100755 --- a/scripts/ci/set_digests.py +++ b/scripts/ci/set_digests.py @@ -1,15 +1,17 @@ #!/usr/bin/env python3 -"""Rewrite the visualci kustomization's commit line and image digests: set_digests.py .""" +"""Rewrite the visualci kustomization's commit line and image digests: set_digests.py . + +The app is visualci-app, the Laravel Rust app in app/ (since the sc-8900 cutover).""" import re import sys -path, commit, server, renderer = sys.argv[1:5] -for d in (server, renderer): +path, commit, app, renderer = sys.argv[1:5] +for d in (app, renderer): if not d.startswith("sha256:"): sys.exit(f"not a digest: {d!r}") text = open(path).read() text = re.sub(r"^# visualci commit: [0-9a-f]{40}$", f"# visualci commit: {commit}", text, flags=re.M) -for name, digest in (("visualci-server", server), ("visualci-renderer", renderer)): +for name, digest in (("visualci-app", app), ("visualci-renderer", renderer)): text, n = re.subn( rf"(- name: ghcr\.io/docspring/{name}\n\s+digest: )sha256:[0-9a-f]+", rf"\g<1>{digest}", text )