From e9d7b12c6699ab53e688acf571e6bde6644f098c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A1=E5=8F=A3=E6=B5=AA=E4=BA=BA?= Date: Mon, 12 Oct 2026 21:12:44 +0800 Subject: [PATCH] Release deployment lock before pruning old production image --- scripts/production-deploy.py | 5 ++++- tests/test_production_deploy.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/production-deploy.py b/scripts/production-deploy.py index 88dbc1a..bc8dcea 100644 --- a/scripts/production-deploy.py +++ b/scripts/production-deploy.py @@ -850,7 +850,6 @@ class Deploy: self.state["status"] = "success" self.state_io(self.state) print("DEPLOY VERIFIED", flush=True) - self.cleanup_images() except BaseException as exc: print("DEPLOY FAILED:", type(exc).__name__, flush=True) self.diagnostics() @@ -873,6 +872,10 @@ class Deploy: if safe_unlock: self.unlock() + # The deployment lock itself references the old image. Release it + # before retention; other container references remain protected. + self.cleanup_images() + def recover(self, manual=False): self.settings() lock = self.run( diff --git a/tests/test_production_deploy.py b/tests/test_production_deploy.py index e5ccbc5..b7a0316 100644 --- a/tests/test_production_deploy.py +++ b/tests/test_production_deploy.py @@ -137,6 +137,7 @@ def test_deploy_rolls_back_exact_baseline_without_deleting_data( else: tool.deploy() assert cleanup == ["success"] + assert "unlock" in calls assert activated == [new] assert saved[-1]["status"] == "success" assert saved[-1]["rollback_tag"] == tool.old_image_tag + "-rollback"