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

adding regex support to the ancestor ps filter function #16191

Merged

Conversation

odra
Copy link
Contributor

@odra odra commented Oct 15, 2022

Closes #16180

This PR adds regular expression support the ancestor ps filter by uisng util.StringMatchRegexSlice instead of comparing the exact string value.

The same function is used by the name filter.

Does this PR introduce a user-facing change?

Yes, it adds regular expression support when using the ancestor ps filter, examples:

podman ps --filter ancestor=registry.fedoraproject.org/fedora:latest
podman ps --filter ancestor=registry.fedoraproject.org
podman ps --filter ancestor=fedoraproject.*/fedora
Added: Regular expression support for "podman ps --filter ancestor"

@odra odra force-pushed the fix-16180_ancestor-filter-regex branch from 455ff1d to 0c6472a Compare October 15, 2022 15:54
@@ -96,8 +96,8 @@ func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpo
}

if (rootfsImageID == filterValue) ||
(rootfsImageName == filterValue) ||
(imageNameWithoutTag == filterValue && imageTag == "latest") {
util.StringMatchRegexSlice(rootfsImageName, filterValues) ||
Copy link
Member

Choose a reason for hiding this comment

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

Whitespace here is a little weird, please gofmt the file

@mheon
Copy link
Member

mheon commented Oct 16, 2022

@edsantiago PTAL at the test

@@ -81,6 +81,30 @@ echo $image
########
podman run --rm $image ls -alF /etc

########
Copy link
Member

Choose a reason for hiding this comment

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

This is a NOP. This "baseline" file, whatever it is, is not run or used anywhere. (I'll look into getting rid of it). Tests exist in test/system and test/e2e.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed this change and added a coupe of tests to test/e2e/ps_test.go

@odra odra force-pushed the fix-16180_ancestor-filter-regex branch from 0c6472a to f59a9c2 Compare October 18, 2022 12:16
@odra odra force-pushed the fix-16180_ancestor-filter-regex branch from f59a9c2 to 6c7ae37 Compare October 21, 2022 11:59
@rhatdan
Copy link
Member

rhatdan commented Oct 24, 2022

/approve
LGTM
@mheon @vrothberg PTAL

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 24, 2022
@mheon
Copy link
Member

mheon commented Oct 24, 2022

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 24, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 24, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon, odra, rhatdan

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-merge-robot openshift-merge-robot merged commit 51a9bc8 into containers:main Oct 24, 2022
@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 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 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. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman ps --filter ancestor= should support regular expression to match image name
5 participants