Release deployment lock before pruning old production image

This commit is contained in:
渡口浪人
2026-10-12 21:12:44 +08:00
parent b46fbea4c9
commit e9d7b12c66
2 changed files with 5 additions and 1 deletions
+4 -1
View File
@@ -850,7 +850,6 @@ class Deploy:
self.state["status"] = "success" self.state["status"] = "success"
self.state_io(self.state) self.state_io(self.state)
print("DEPLOY VERIFIED", flush=True) print("DEPLOY VERIFIED", flush=True)
self.cleanup_images()
except BaseException as exc: except BaseException as exc:
print("DEPLOY FAILED:", type(exc).__name__, flush=True) print("DEPLOY FAILED:", type(exc).__name__, flush=True)
self.diagnostics() self.diagnostics()
@@ -873,6 +872,10 @@ class Deploy:
if safe_unlock: if safe_unlock:
self.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): def recover(self, manual=False):
self.settings() self.settings()
lock = self.run( lock = self.run(
+1
View File
@@ -137,6 +137,7 @@ def test_deploy_rolls_back_exact_baseline_without_deleting_data(
else: else:
tool.deploy() tool.deploy()
assert cleanup == ["success"] assert cleanup == ["success"]
assert "unlock" in calls
assert activated == [new] assert activated == [new]
assert saved[-1]["status"] == "success" assert saved[-1]["status"] == "success"
assert saved[-1]["rollback_tag"] == tool.old_image_tag + "-rollback" assert saved[-1]["rollback_tag"] == tool.old_image_tag + "-rollback"