Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions scripts/ci/set_digests.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/usr/bin/env python3
"""Rewrite the visualci kustomization's commit line and image digests: set_digests.py <file> <commit> <server> <renderer>."""
"""Rewrite the visualci kustomization's commit line and image digests: set_digests.py <file> <commit> <app> <renderer>.

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
)
Expand Down
Loading