Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add volume prune --filter support #8689

Merged

Conversation

bblenard
Copy link

This change adds support for the --filter / ?filters arguments on
the podman volume prune subcommand.

  • Adds ParseFilterArgumentsIntoFilters helper for consistent
    Filter string slice handling
  • Adds --filter support to podman volume prune cli
  • Adds ?filters... support to podman volume prune api
  • Updates apiv2 / e2e tests

Closes #8672

Signed-off-by: Baron Lenardson [email protected]

// VolumePruneOptions describes the options needed
// to prune a volume from the CLI
type VolumePruneOptions struct {
Filters url.Values `json:"filters" schema:"filters"`
Copy link
Author

Choose a reason for hiding this comment

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

I was conflicted whether to use url.Values or the underlying type of map[string][]string for the filters. I saw it both ways throughout the codebase. I settled on url.Values but I don't feel strongly either way. I thought I remember seeing some mention of a refactor for filters so hopefully the inconsistency can be fixed then.

Copy link
Member

Choose a reason for hiding this comment

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

I feel like we should use map[string][]string everywhere.
@baude @jwhonce WDYT?

Copy link
Author

Choose a reason for hiding this comment

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

Once @baude / @jwhonce add their input I can fix the other things you mentioned @Luap99 (since the type will effect the changes you requested, even though its not much different).

Copy link
Member

Choose a reason for hiding this comment

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

Just keep it for now. It will be reworked soon.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @bblenard.

This looks really good.
You still have to document the --filter flag in docs/source/markdown/podman-volume-prune.1.md and fix the bindings test in pkg/bindings/test/volumes_test.go.

@bblenard
Copy link
Author

Thanks for the contribution @bblenard.

This looks really good.
You still have to document the --filter flag in docs/source/markdown/podman-volume-prune.1.md and fix the bindings test in pkg/bindings/test/volumes_test.go.

Documented the filter flag here: 41861e3

- scope
- label
- opt
- dangling
Copy link
Member

Choose a reason for hiding this comment

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

Alphabetize this list please

Copy link
Author

Choose a reason for hiding this comment

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

Fixed: c8a7b9a

@bblenard
Copy link
Author

Should I squash my feedback commits so the CI pipeline goes? (I think that is the issue)

@mheon
Copy link
Member

mheon commented Dec 12, 2020 via email

@bblenard bblenard force-pushed the issue-8672-volume-prune branch from 0a39fda to 6e8217d Compare December 12, 2020 02:30
This change adds support for the `--filter` / `?filters` arguments on
the `podman volume prune` subcommand.

  * Adds ParseFilterArgumentsIntoFilters helper for consistent
    Filter string slice handling
  * Adds `--filter` support to podman volume prune cli
  * Adds `?filters...` support to podman volume prune api
  * Updates apiv2 / e2e tests

Closes containers#8672

Signed-off-by: Baron Lenardson <[email protected]>
@bblenard bblenard force-pushed the issue-8672-volume-prune branch from 6e8217d to a0204ad Compare December 13, 2020 02:07
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bblenard, Luap99

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 13, 2020
@rhatdan
Copy link
Member

rhatdan commented Dec 14, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2020
@openshift-merge-robot openshift-merge-robot merged commit e5741b9 into containers:master Dec 14, 2020
@@ -214,7 +214,7 @@ func (ic *ContainerEngine) SystemPrune(ctx context.Context, options entities.Sys
systemPruneReport.ImagePruneReport.Report.Id = append(systemPruneReport.ImagePruneReport.Report.Id, results...)
}
if options.Volume {
volumePruneReport, err := ic.pruneVolumesHelper(ctx)
volumePruneReport, err := ic.pruneVolumesHelper(ctx, nil)
Copy link
Member

Choose a reason for hiding this comment

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

This should be passing down the prune filters.

podman system prune --filter should be passed down to volume helper as well.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that was my mistake. I can open a PR for that tonight.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks,
BTW great job on this PR.

Copy link
Author

Choose a reason for hiding this comment

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

@rhatdan PR opened: #8724

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman volume prune --filter missing
7 participants