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 negation to filters #971
Add negation to filters #971
Conversation
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! Could you add a couple of tests to libimage/filters_test.go
to make sure it's working as expected and that we won't regress in the future?
Yeah of course, but I was thinking about it, is there any image that has like a testable label I could use for it? Because as an example,
|
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan, rvandernoort 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 |
LGTM |
@vrothberg @giuseppe PTAL |
473ad66
to
edef90b
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.
Code LGTM but we need tests.
@vrothberg I created a test for it now locally, but as I stated I need a testimage with a label, which I couldn't find. I created a simple Dockerfile for it now, can I upload this or something similar somewhere in the lipbod registry on quay to retrieve it in the test?
|
@rvandernoort, there are other filters that we can (and should) use for testing. For testing the label filter, you could use the following one:
|
edef90b
to
146e4e3
Compare
Yes perfect thank you! I've pushed the first test with the label filter, I'll make the remainder of the tests for the different filters soon. |
146e4e3
to
0580dd6
Compare
Alright so I updated the test suite to cover more labels with and without negation. I did get stuck with running a container inside the unit tests here for the specific images in order to test the |
Thanks a lot, @rvandernoort! Just one minor nit and then we can merge. |
Signed-off-by: rvandernoort <s.r.vandernoort@student.tudelft.nl>
0580dd6
to
b3cbd69
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.
/lgtm
/hold
Thank you!
/hold cancel |
This PR closes this issue, which adds a negation option to all filters for the
podman images --filter
command. I tested this locally by building an image with a label ofversion:0.1
and runningbin/podman images --filter 'label=version=0.1'
gives me only this image listed and runningbin/podman images --filter 'label!=version=0.1'
gives me all other images listed. I also tested the other filter options, and they all have the same effect!Signed-off-by: rvandernoort s.r.vandernoort@student.tudelft.nl