-
Notifications
You must be signed in to change notification settings - Fork 90
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
fix searching on non-searchable image registries #1821
fix searching on non-searchable image registries #1821
Conversation
I already had this container on my system: I tried a few example ones, but perhaps they're not actually there... Then I tried a container that GitHub talked about called "Super Linter", which has this as a container URI: If you add the URI without the @..., it seems like it'd work: But you have to specifically click on the item in the dropdown. (Is that intended?) If you change the focus, the entry goes blank. Also, if you try to edit the text (like if you have a typo, like copying the URI incorrectly), the entry also goes blank. However, it does seem to work if you click on the entry, so that's great! I see a related discussion at https://github.com/orgs/community/discussions/26279 which uses tags/list but it seems things need a token, so I guess that won't work for us. |
9934989
to
c0b19df
Compare
c0b19df
to
bfa093e
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.
Cheers! Please update the commit message to explain the change more verbosely (use case, reference to https://issues.redhat.com/browse/COCKPIT-1148 and the correspondig upstream and RHEL issues).
f916975
to
5a5fe4a
Compare
fedora 41 fails because of this:
I checked f40 and it gives a warning rather than "not implemented" error. Both are on version 5.2.0 idk what this means/how to fix for now, will look into it |
5a5fe4a
to
24d666e
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 for the fixes! Next round.
This comment was marked as resolved.
This comment was marked as resolved.
It's getting there! I found two interaction problems so far:
I was testing with |
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.
(fix the issues with the spaces and hitting enter, as pointed out above; thanks!)
searches.push(...utils.fallbackRegistries.map(registry => | ||
this.activeConnection.call({ | ||
method: "GET", | ||
path: client.VERSION + "libpod/images/search", | ||
body: "", | ||
params: { | ||
term: registry + "/" + value |
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 is a significant piece of code, please add a test for fallback registries.
# Searching for container by prefix fails | ||
b.set_input_text("#create-image-image-select-typeahead", "localhost:80/my-busy") | ||
b.wait_text("button.pf-v5-c-select__menu-item.pf-m-disabled", "No images found") | ||
b.wait_in_text(".pf-v5-c-alert.pf-m-danger", "couldn't search registry") |
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 shouldn't be "danger", but "info" or "default". (It needs to be changed in the code, but it's visible here)
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 can't think of a way how to set it to "info" for this specific error message. I've learnt from the previous reviews that msg.includes("couldn't search registry")
is a no go 😅
test/check-application
Outdated
b.wait_text("button.pf-v5-c-select__menu-item.pf-m-disabled", "No images found") | ||
b.wait_in_text(".pf-v5-c-alert.pf-m-danger", "couldn't search registry") | ||
|
||
# Searching for full url with tag finds the image |
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.
s/url with //
@tomasmatus thanks! I cleaned up outdated review threads and comments to make the remaining stuff easier to see. There's a few small things to fix; if you really don't want to rewrite/simplify the search result loop (which is so hard to read and so easy to get wrong!), perhaps @jelly can help with that, or also me when I'm back from PTO. I also wouldn't veto landing it as-is and cleaning up later, if @jelly is ok with it. But in three weeks nobody of us will be able to follow that logic.. |
yes, I agree with this, let's not |
a1ceaef
to
839df1d
Compare
@martinpitt if you'd like to have a look it is this Select that is misbehaving. What happens is when you type something in and press enter the input bar is cleared rather than preserve the value. It is also cleared once the input loses focus. This shouldn't be happening as the |
I can reproduce the issue on main. AFAICS the only sensible thing is to ignore the Enter key completely then -- if you type a random string into the image bar, it cannot be "accepted" as a valid value (which is usually the meaning of "Enter"). You must actually select a valid image for the dialog to make sense. Clearing an invalid value on focus change also makes sense IMHO. However, I do see how this would collide with the workflow of this PR -- it'd still force you to actually click on the search result instead of just copy&pasting an image name and doing nothing else. Did I get this right? The demo on the PF docs (v4, as that's the deprecated one) behaves in the above way: "Enter" is a no-op, and changing focus clears the input value. This doesn't do any special keyboard input tricks. My hunch is that it's the |
Pressing "Enter" in the dialog on any active form element (such as the search input or the checkboxes) previously bubbled up to the Form, which then activated the first popover help. This is unexpected and very irritating especially when using the search input. Just ignore the Enter key to fix that, similar to what the image search modal already does. See cockpit-project#1821 (comment)
@tomasmatus Fixed in #1861 . This is independent from this PR. |
Pressing "Enter" in the dialog on any active form element (such as the search input or the checkboxes) previously bubbled up to the Form, which then activated the first popover help. This is unexpected and very irritating especially when using the search input. Just ignore the Enter key to fix that, similar to what the image search modal already does. See cockpit-project#1821 (comment)
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.
Cheers @tomasmatus ! The previous review still has three current threads, and I have some more questions. This is coming together!
Pressing "Enter" in the dialog on any active form element (such as the search input or the checkboxes) previously bubbled up to the Form, which then activated the first popover help. This is unexpected and very irritating especially when using the search input. Just ignore the Enter key to fix that, similar to what the image search modal already does. See cockpit-project#1821 (comment)
Pressing "Enter" in the dialog on any active form element (such as the search input or the checkboxes) previously bubbled up to the Form, which then activated the first popover help. This is unexpected and very irritating especially when using the search input. Just ignore the Enter key to fix that, similar to what the image search modal already does. See #1821 (comment)
839df1d
to
e3a89f2
Compare
Garrett's feedback was addressed
fixes: cockpit-project#1220 Add support to pull images from registries which do not support search API.
e3a89f2
to
5d7da5a
Compare
if (dialogError === "" && dialogErrorDetail === "") { | ||
dialogError = _("Failed to search for new images"); | ||
// TODO: add registry context, podman does not include it in the reply. | ||
dialogErrorDetail = reason ? cockpit.format(_("Failed to search for images: $0"), reason.message) : _("Failed to search for images."); |
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 added line is not executed by any test.
if (!RE_CONTAINER_TAG.test(value)) { | ||
// If there are registries configured search in them, or if a user searches for `docker.io/cockpit` let | ||
// podman search in the user specified registry. | ||
if (Object.keys(this.props.podmanInfo.registries).length !== 0 || value.includes('/')) { |
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 added line is not executed by any test.
searches.push(...utils.fallbackRegistries.map(registry => | ||
this.activeConnection.call({ | ||
method: "GET", | ||
path: client.VERSION + "libpod/images/search", | ||
body: "", | ||
params: { | ||
term: registry + "/" + value |
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.
These 7 added lines are not executed by any test.
dialogError = _("Failed to search for new images"); | ||
// TODO: add registry context, podman does not include it in the reply. | ||
dialogErrorDetail = result.reason ? cockpit.format(_("Failed to search for images: $0"), result.reason.message) : _("Failed to search for images."); | ||
} else if (!manifestResult && !imageExistsLocally(value, this.props.localImages)) { |
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 added line is not executed by any test.
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.
Wohoo! Thanks!
@tomasmatus Can you please add an initial release note to the description, and an up to date screenshot? (Please use the inspector to cut out the dialog precisely, and add a |
fixes: #1220
Add support to pull images from registries which do not support search API.
https://issues.redhat.com/browse/COCKPIT-1148
Podman: pull images from registries without search API
When creating a new container it is now possible to use registries that do not support API for searching containers such as ghcr.io. It is also possible to select a specific tag for the image.