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

Fixup search #9070

Merged
merged 1 commit into from
Jan 26, 2021
Merged

Fixup search #9070

merged 1 commit into from
Jan 26, 2021

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Jan 22, 2021

podman-remote search had some FIXMEs in tests that were failing.
So I reworked the search handler to use the local abi. This
means the podman search and podman-remote search will use the
same functions.

While doing this, I noticed we were just outputing errors via
logrus.Error rather then returning them, which works ok for
podman but the messages get lost on podman-remote. Changed
the code to actually return the error messages to the caller.

This allows us to turn on the remaining podman-remote FIXME
tests.

Signed-off-by: Daniel J Walsh [email protected]

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 22, 2021
if err != nil {
utils.Error(w, "failed to retrieve repository credentials", http.StatusBadRequest, errors.Wrapf(err, "failed to parse %q header for %s", key, r.URL.String()))
utils.Error(w, "Something went wrong.", http.StatusNotFound, err)
Copy link
Member

Choose a reason for hiding this comment

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

We need to distinguish between Not Found and Internal Server Error here.

Copy link
Member Author

Choose a reason for hiding this comment

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

NotFound is not an error, it just returns nothing.

$ ./bin/podman search registry.access.redhat.com/danwalsh
$ ./bin/podman-remote  search registry.access.redhat.com/danwalsh
$

Copy link
Member

Choose a reason for hiding this comment

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

If NotFound is not an error, why are we returning it here? Docker API indicates the correct code is 500 - https://docs.docker.com/engine/api/v1.40/#operation/ImageSearch

Copy link
Member Author

Choose a reason for hiding this comment

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

Well podman search imagenotfound

Does not return an error.

I don't think we should do podman search imagenotfound to return an error.

But if we have to, then I will need to do this for only compat endpoint.

@rhatdan rhatdan force-pushed the search branch 4 times, most recently from 712c01e to c40b050 Compare January 24, 2021 12:52
Copy link
Member

@ashley-cui ashley-cui left a comment

Choose a reason for hiding this comment

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

LGTM

@baude
Copy link
Member

baude commented Jan 25, 2021

i personally do not like the idea of combining the podman and compat endpoints when they have differently supported variables. I think it is asking for problems in the future. that said, lgtm

if err != nil {
utils.BadRequest(w, "term", query.Term, err)
utils.Error(w, "Something went wrong.", http.StatusBadRequest, err)
Copy link
Member

Choose a reason for hiding this comment

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

This should be StatusInternalServerError

Copy link
Member

Choose a reason for hiding this comment

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

A Bad Parameters is handled above, line 33. This is a more general "things have gone wrong" error which is a 500.

These error codes are the best error handling we have in the HTTP API so we need to get them right.

podman-remote search had some FIXMEs in tests that were failing.
So I reworked the search handler to use the local abi.  This
means the podman search and podman-remote search will use the
same functions.

While doing this, I noticed we were just outputing errors via
logrus.Error rather then returning them, which works ok for
podman but the messages get lost on podman-remote.  Changed
the code to actually return the error messages to the caller.

This allows us to turn on the remaining podman-remote FIXME
tests.

Signed-off-by: Daniel J Walsh <[email protected]>
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM

@vrothberg
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 26, 2021
@openshift-merge-robot openshift-merge-robot merged commit efcd48b into containers:master Jan 26, 2021
@mheon
Copy link
Member

mheon commented Mar 22, 2021

I'm coming back to this as I write the release notes for v3.1.0-RC2, and I notice that we did not document the new options added to the handler in Swagger. The same can be said of the other reworks Dan did this patch cycle.

What's the thinking on these - are they internal-only and undocumented otherwise, or do we need to go back and find everything added and add docs? @jwhonce @baude @rhatdan

@rhatdan
Copy link
Member Author

rhatdan commented Mar 23, 2021

These are internal and bug fixes.

@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 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants