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 --force flag to images prune #4519

Closed
wants to merge 1 commit into from
Closed

Conversation

tylarb
Copy link
Contributor

@tylarb tylarb commented Nov 15, 2019

Add a -f, --force flag to images prune. As there was previously no
prompt to force prune images, this commit does nothing to add such a
question, only make the cli command compatible with docker cli.

Resolves #4410

Signed-off-by: Tyler Ramer [email protected]


Commentary

I can adjust the commit to include a prompt if --force is not included, so the cli is not just compatible with docker cli but identical.

However, if you want to add this, I wanted to propose the following thoughts:

  • Other force flags don't remove a prompt - they do a potentially unsafe action (i.e. removing mounted volumes, removing networks that may be in use, etc). Pruning images may require additional build time, but is not unsafe, as far as I am aware.
  • It is possible people are relying on the image prune cli not needing a --force flag - is it important to keep this cli backwards compatibility in that case?

Add a -f, --force flag to images prune. As there was previously no
prompt to force prune images, this commit does nothing to add such a
question, only make the cli command compatible with docker cli.

Resolves containers#4410

Signed-off-by: Tyler Ramer <[email protected]>
@openshift-ci-robot openshift-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS labels Nov 15, 2019
@openshift-ci-robot
Copy link
Collaborator

Hi @tylarb. Thanks for your PR.

I'm waiting for a containers member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tylarb
To complete the pull request process, please assign mrunalp
You can assign the PR to them by writing /assign @mrunalp in a comment when ready.

The full list of commands accepted by this bot can be found 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

@tylarb
Copy link
Contributor Author

tylarb commented Nov 15, 2019

There is a failure - but it's not in anything I added, rather in containers prune.

Looks like the test is here:

"test/e2e/prune_test.go"

 41 ⇥       It("podman container prune containers", func() {
 42 ⇥       ⇥       top := podmanTest.RunTopContainer("")
 43 ⇥       ⇥       top.WaitWithDefaultTimeout()
 44 ⇥       ⇥       Expect(top.ExitCode()).To(Equal(0))
 45 
 46 ⇥       ⇥       session := podmanTest.Podman([]string{"run", ALPINE, "ls"})
 47 ⇥       ⇥       session.WaitWithDefaultTimeout()
 48 ⇥       ⇥       Expect(session.ExitCode()).To(Equal(0))
 49 
 50 ⇥       ⇥       prune := podmanTest.Podman([]string{"container", "prune"})
 51 ⇥       ⇥       prune.WaitWithDefaultTimeout()
 52 ⇥       ⇥       Expect(prune.ExitCode()).To(Equal(0))
 53 
 54 ⇥       ⇥       Expect(podmanTest.NumberOfContainers()).To(Equal(1))
 55 ⇥       })
libpod(force_flag)$ ./bin/podman container prune containers
Error: `podman container prune` takes no arguments
libpod(force_flag)$ ./bin/podman container prune
# works     

@tylarb
Copy link
Contributor Author

tylarb commented Nov 15, 2019

/assign @mrunalp

@tylarb
Copy link
Contributor Author

tylarb commented Nov 15, 2019

Just noticed as well that #4512 is related to this PR.

@TomSweeneyRedHat
Copy link
Member

Yes I think this and #4512 are dueling PRs and this fixes a subset of what #4512 is doing. @tylarb thanks for the PR, but I think it would probably be best to close this one and continue with #4512. @mheon WDYT?

@mheon
Copy link
Member

mheon commented Nov 15, 2019

Concur. We'll go with #4512 in this case for the added functionality. Regardless, thanks for the PR, @tylarb

@mheon mheon closed this Nov 15, 2019
@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 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support -f/--force flag in podman image prune
5 participants