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
image prune command fixed as per docker image prune. #4512
image prune command fixed as per docker image prune. #4512
Conversation
Warning message added before executing image prune Added a force option, to execute without user input. Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
timetype package include functions for calculating time input in string as one of golang duration format and calculate as unix timestamp Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
@kunalkushwaha you've a gofmt issue, you need to run: |
you can also just run make validate |
8bdb4b2
to
ebfb3ed
Compare
ebfb3ed
to
e37b50e
Compare
@TomSweeneyRedHat @baude All tests are green now. PTAL |
libpod/image/image.go
Outdated
// Filter is a function to determine whether a image is included | ||
// in command output. Images to be outputted are tested using the function. | ||
// A true return will include the image, a false return will exclude it. | ||
type Filter func(*Image) bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this to ImageFilter
? I can see us adding Container filters and Pod filters in the future, too, which might give us name collisions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially named this Filter
as ImageFilter
. But make validate
reports error as its part of image package and user need to use image.ImageFilter
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we either tell validate to be quiet or make it plural
ImagesFilter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. used //nolint
for ignoring the check against ImageFilter
libpod/image/prune.go
Outdated
// GetPruneImages returns a slice of images that have no names/unused | ||
func (ir *Runtime) GetPruneImages(all bool) ([]*Image, error) { | ||
func (ir *Runtime) GetPruneImages(all bool, filters []string) ([]*Image, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to have this accept a []ImageFilter
instead, and converting from string to filter earlier.
code changes LGTM other than @mheon's comments. |
and most importantly, THANKS @kunalkushwaha for this pr. It will be a nice add to Podman once complete. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kunalkushwaha, mheon 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 |
filter option accepts two filters. - label - until label supports "label=value" or "label=key=value" format until supports all golang compatible time/duration formats. Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
6fd69ac
to
e38fd8e
Compare
examples of image prune with filter and until options added Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
e38fd8e
to
c7d911e
Compare
Our old friend the prune remote test is failing again, restarting. |
LGTM if we can get the tests happy. Current test issues I don't believe are related to this PR. |
/lgtm |
makes
podman image prune
aligned with docker image prune command.This PR makes following changes.
podman image prune
now ask for confirmation from user with warning message.adds
--force
flag, which do not ask for any confirmation. Fixes Support-f
/--force
flag inpodman image prune
#4410adds
--filter
flag, which supportslabel
&until
format. Fixes Support--filter
flag inpodman image prune
#4411e.g.
Signed-off-by: Kunal Kushwaha kunal.kushwaha@gmail.com