v0.331.0: a removal deletes the volumes still labelled with the app's project that its definition no longer declares (R-1117)
gates / gates (push) Successful in 42s
gates / gates (push) Successful in 42s
compose down --volumes removes only the current definition's volumes; a volume a template dropped (or an older restore re-created) survived 'remove with data' on 9202 (nextcloud_nextcloud_redis_data). Red-proofed.
This commit is contained in:
@@ -756,6 +756,17 @@ func (m *Manager) RemoveStack(name string, removeHDDData bool, backupPathsToRemo
|
||||
if n := m.RemoveUndoCopies(name); n > 0 {
|
||||
m.logger.Printf("[INFO] [stacks] RemoveStack %s: removed %d undo copy volume(s)", name, n)
|
||||
}
|
||||
// R-1117: `down --volumes` removes only what the CURRENT definition declares. A volume a template dropped (or a
|
||||
// restore re-created from an older unit) still carries the app's project label and outlived the removal (measured
|
||||
// on 9202, 2026-10-18: nextcloud_nextcloud_redis_data). The removal removes volumes, so those go too — by name, and
|
||||
// only the ones labelled with THIS project. Pinned by TestR1117_RemoveDeletesALabelledVolumeTheDefinitionNoLongerDeclares.
|
||||
for _, v := range m.projectVolumes(name) {
|
||||
if out, err := m.execCommand("docker", "volume", "rm", v); err != nil {
|
||||
m.logger.Printf("[WARN] [stacks] RemoveStack %s: leftover volume %s not removed: %v (%s)", name, v, err, strings.TrimSpace(out))
|
||||
} else {
|
||||
m.logger.Printf("[INFO] [stacks] RemoveStack %s: removed leftover volume %s (the app's project label; not in its definition — R-1117)", name, v)
|
||||
}
|
||||
}
|
||||
|
||||
// Step 3: the volumes that are gone now — `[]` when none, never null (R-489).
|
||||
resp.VolumesRemoved = removedVolumes(volsBefore, m.appVolumeSet(name, stackDir))
|
||||
|
||||
Reference in New Issue
Block a user