Skip to content

fix(volume/prune): document and test label! filter support#7052

Open
mohithshuka wants to merge 1 commit into
docker:masterfrom
mohithshuka:fix/volume-prune-label-filter
Open

fix(volume/prune): document and test label! filter support#7052
mohithshuka wants to merge 1 commit into
docker:masterfrom
mohithshuka:fix/volume-prune-label-filter

Conversation

@mohithshuka

Copy link
Copy Markdown

What does this PR do?

The --filter flag description for docker volume prune only mentioned
label=<label> but not label!=<label>, making it inconsistent with
docker system prune which documents both forms.

The label! filter already works correctly via the shared PruneFilters
function — it was just undocumented and untested at the volume prune level.

Changes

  • Updated --filter flag description to include label!=<label> example
  • Added unit test for label! filter to match the existing label filter test

How to test

Fixes #6918

The --filter flag description for 'docker volume prune' only mentioned
'label=<label>' but not 'label!=<label>', even though the label!
filter is supported and handled correctly by the underlying
PruneFilters function.

This commit:
- Updates the --filter flag description to include label!=<label>
- Adds a unit test for the label! filter to match the existing
  label filter test

Fixes docker#6918

Signed-off-by: mohithshuka <YOUR_ID+mohithshuka@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 14, 2026 16:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds coverage and CLI help text for using a negated label filter (label!=...) with volume prune, including new golden output for the interactive confirmation flow.

Changes:

  • Add a new label!=... filter test case for volume prune.
  • Add a new golden file for the label-not-filter test output.
  • Update volume prune --filter help text to mention label!=<label>.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
cli/command/volume/testdata/volume-prune-success.label-not-filter.golden Adds golden output for the new label!= filter test scenario.
cli/command/volume/prune_test.go Introduces a new test case asserting label!=foobar is parsed into the expected filters structure.
cli/command/volume/prune.go Updates --filter help text to document label!=<label> usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +105 to +106
name: "label-not-filter",
args: []string{"--filter", "label!=foobar"},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent behavior between label and label! filters in volume prune

2 participants