From 387c0bedf4d587e044b76e768f4ca28a3922f63c Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Sun, 6 Dec 2026 10:50:54 -0600 Subject: [PATCH] Flush edge caches after website deployment --- docs/app-ops.md | 5 +++++ docs/templates/app-ops.md.tmpl | 5 +++++ lib/jeannie/pipeline.sh | 4 ++++ tests/jeannie/test_website_cv.py | 10 ++++++++++ 4 files changed, 24 insertions(+) diff --git a/docs/app-ops.md b/docs/app-ops.md index a3a3f7d..545888d 100644 --- a/docs/app-ops.md +++ b/docs/app-ops.md @@ -665,6 +665,11 @@ for example `192.168.100.73:30500/php-website:src-...`. If it still shows Check the `website-production` Application source, sync status, and repository access before restarting pods. +After the website rollout is ready, `./jeannie apps website` flushes +the OCI edge nginx, Varnish, and Squid caches. The purge also runs when the +immutable image was already current, so retrying the deployment can recover +from an earlier edge connection or cache-purge failure. + The first demo, `The Client-Side Media Cruncher (Wasm + TS)`, currently performs private, browser-only image compression and conversion using native Canvas APIs. Heavier video conversion, such as MP4 to WebM, should use a Rust core compiled diff --git a/docs/templates/app-ops.md.tmpl b/docs/templates/app-ops.md.tmpl index c1c1d52..6407b69 100644 --- a/docs/templates/app-ops.md.tmpl +++ b/docs/templates/app-ops.md.tmpl @@ -665,6 +665,11 @@ for example `192.168.100.73:30500/php-website:src-...`. If it still shows Check the `website-production` Application source, sync status, and repository access before restarting pods. +After the website rollout is ready, `./{{ main_script }} apps website` flushes +the OCI edge nginx, Varnish, and Squid caches. The purge also runs when the +immutable image was already current, so retrying the deployment can recover +from an earlier edge connection or cache-purge failure. + The first demo, `The Client-Side Media Cruncher (Wasm + TS)`, currently performs private, browser-only image compression and conversion using native Canvas APIs. Heavier video conversion, such as MP4 to WebM, should use a Rust core compiled diff --git a/lib/jeannie/pipeline.sh b/lib/jeannie/pipeline.sh index 5f4d116..56f2ee2 100644 --- a/lib/jeannie/pipeline.sh +++ b/lib/jeannie/pipeline.sh @@ -8683,6 +8683,10 @@ apps() ( if [[ "${website_image_built}" == "true" ]]; then write_website_image_state "${website_image_state_file}" "${website_source_hash}" "${website_platforms}" "${website_image_ref}" fi + # The public edge caches HTML and static assets independently from the + # immutable Kubernetes image. Purge them after every successful + # website reconciliation so retries also recover from a failed purge. + edge_flush_caches || return 1 fi if [[ "${deploy_demos}" == "true" ]]; then diff --git a/tests/jeannie/test_website_cv.py b/tests/jeannie/test_website_cv.py index 7ced04f..6c7801b 100644 --- a/tests/jeannie/test_website_cv.py +++ b/tests/jeannie/test_website_cv.py @@ -19,6 +19,16 @@ class WebsiteCVTests(unittest.TestCase): self.assertIn('target="_blank"', page) self.assertNotIn("window.print()", page) + def test_website_deploy_flushes_edge_after_rollout(self): + pipeline = (ROOT / "lib" / "jeannie" / "pipeline.sh").read_text() + rollout = pipeline.index( + "wait_for_deployment_ready website-production php-website-deployment" + ) + flush = pipeline.index("edge_flush_caches || return 1", rollout) + next_deployment = pipeline.index('if [[ "${deploy_demos}" == "true" ]]', rollout) + self.assertLess(rollout, flush) + self.assertLess(flush, next_deployment) + if __name__ == "__main__": unittest.main()