fix(deployments): protect carried-forward containers on compose deploy failure - #517
Open
santhiprakash wants to merge 1 commit into
Open
Conversation
…y failure - Problem: onFailure destroyed every service container on the failed deployment's rows, including containers carried verbatim from the still-live previous release, taking the app down while activeDeploymentId stayed put. - Fix: tear down failed-deploy resources via collectDeploymentManifest with protectRetained: true, matching reject/delete/cancel teardown paths. - Verification: bun run test test/modules/deployments/on-failure-keep-set.test.ts test/modules/deployments/reject-keep-set.test.ts (9 passed). Fixes oblien#500
santhiprakash
force-pushed
the
fix/onfailure-carried-forward-containers
branch
from
August 15, 2026 04:59
ef438dd to
dfa10ed
Compare
Contributor
Author
|
Rebased onto current main and re-ran the tests locally: The Typecheck/Test CI failures on this PR are pre-existing on main itself — |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #500 —
onFailureno longer destroys containers carried verbatim from the still-live previous release when a multi-service compose deploy fails partway through.Problem
On a compose project, a redeploy that carries unchanged services forward and then fails on a later step runs
onFailure, which iterated every service row on the failed deployment and calledruntime.destroyon eachcontainerId. Carried-forward rows name the same container as the active release, so a failed redeploy took the live app down whileactiveDeploymentIdstill pointed at the previous release.Triage / Root cause
onFailureindeployment-lifecycle.tsused a naive destroy loop overrepos.service.listByDeployment(dep.id). Reject, delete, and build-cancel teardown paths already consultcollectDeploymentManifest(..., { protectRetained: true })to skip artifacts a live or retained release still references; the failure path was the lone outlier.Fix
runtime.destroyloop withcollectDeploymentManifest+executeCleanupusingprotectRetained: true, matching cancel/reject/delete.on-failure-keep-set.test.tsregression coverage modeled onreject-keep-set.test.ts.Verification
Result: 9 tests passed.
Notes / Risks
onCancelledstill uses the old destroy loop (separate issue if needed).provisioned.imageRefcleanup at the top ofonFailureis unchanged; compose pipeline already cleans built service images before callingonFailure.