Remove the clone container even when the deploy is cancelled (closes #215)
Check / check (pull_request) Skipped

The deferred removal used the deploy context, so a cancelled deploy
(a newer push, or the build timeout) never sent the remove request and
left the clone container and its volume behind. It now uses
context.WithoutCancel, and the test gains a case that cancels the
context while the clone is running.

Model: opus-5-5
This commit is contained in:
2026-09-23 09:28:11 +00:00
parent 86df8f558a
commit 622ec6d18d
2 changed files with 26 additions and 7 deletions
+3 -2
View File
@@ -657,10 +657,11 @@ func (c *Client) performClone(
}
// The git image declares a volume, so Docker gives each clone container
// an anonymous volume; remove it with the container.
// an anonymous volume; remove it with the container. The removal must
// still run when the deploy is cancelled.
defer func() {
_ = c.docker.ContainerRemove(
ctx,
context.WithoutCancel(ctx),
gitContainerID.String(),
container.RemoveOptions{Force: true, RemoveVolumes: true},
)