Remove the git clone container's anonymous volume with it (closes #215)

The pinned alpine/git image declares a volume at /git, so Docker gives
every clone container an anonymous volume. The container was removed
without its volumes, leaving one volume behind per deploy. The removal
now also removes the container's anonymous volumes, on success and on
failure. A test runs a clone against a fake Docker API and checks the
removal asks for volumes to be removed.

Model: opus-5-5
This commit is contained in:
2026-09-23 09:45:07 +00:00
parent ddcd179841
commit a44d4a2647
3 changed files with 78 additions and 1 deletions
+3 -1
View File
@@ -656,11 +656,13 @@ func (c *Client) performClone(
return nil, err
}
// The git image declares a volume, so Docker gives each clone container
// an anonymous volume; remove it with the container.
defer func() {
_ = c.docker.ContainerRemove(
ctx,
gitContainerID.String(),
container.RemoveOptions{Force: true},
container.RemoveOptions{Force: true, RemoveVolumes: true},
)
}()