-
Notifications
You must be signed in to change notification settings - Fork 612
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 image prune --filter support #3319
Add image prune --filter support #3319
Conversation
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
8164d4e
to
7d9b1cc
Compare
d1935e7
to
360423f
Compare
cmd/nerdctl/image_prune_test.go
Outdated
base.Cmd("images", "--all").AssertOutContains(imageName) | ||
|
||
// Pause to ensure enough time has passed for the image to be clean on next prune. | ||
time.Sleep(1 * time.Second) |
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.
This might be too short?
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.
Tried increase the pause to 3 seconds and lowering the requirement to 10ms to provide two orders of magnitude here. Should be pretty reliable. 😅
pkg/imgutil/filtering_test.go
Outdated
}, | ||
{ | ||
name: "SingleMatchingLabel", | ||
imageLabels: map[string]string{"org": "com.containerd.nerdctl"}, |
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.
Better to use com.example...
360423f
to
08d2a8c
Compare
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
08d2a8c
to
7c9751e
Compare
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.
Thanks
Description
This change adds nerdctl image prune
--filter
support including:image prune --filter label=<key>=<value>
image prune --filter until=<timestamp>
Testing
pkg/imgutil
codecmd/nerdctl/image_prune
codeTestImagePruneFilterUntil
does not currently work on Docker. Docker image's created timestamp is aligning with the timestamp of the base image. Docker supports theuntil
filter; just didn't have any ideas for deterministically testing both behaviors.References