Skip to content

Conversation

@Luap99
Copy link
Member

@Luap99 Luap99 commented Mar 21, 2025

Some callers might like to make decisions based on the http server error that was returned.

In particular we would like c/common/pkg/retry to match this error so it can retry image pulls/pushes on 5XX errors as they seems to be a quite common problem[1].

[1] containers/common#2299

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks! The API makes sense.

To be universal: There is also getExternalBlob (though I’m unsure what exactly to do there), getOneSignature, and httpResponseToError. At least the last one is invoked on ~every operation, as one of the first requests, so it might frequently be the one that actually reports a failure.

Some callers might like to make decisions based on the http server error
that was returned.

In particular we would like c/common/pkg/retry to match this error so it
can retry image pulls/pushes on 5XX errors as they seems to be a quite
common problem[1].

[1] containers/common#2299

Signed-off-by: Paul Holzinger <[email protected]>
Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

LGTM, please merge (or ping me) whenever appropriate.

(I wouldn’t mind a newUnexpectedHTTPStatusError(*http.Response) helper, but this is simple enough, and I don’t expect many more instances to be added in the future.)

Luap99 added 2 commits March 24, 2025 11:45
Add a small helper to create the error directly from the http response
without having to set the struct fields at each caller.

Signed-off-by: Paul Holzinger <[email protected]>
So that callers can actually check the status code of all requests if
needed. This changes error text slightly but I think it still carries
the same meaning.

Signed-off-by: Paul Holzinger <[email protected]>
@Luap99
Copy link
Member Author

Luap99 commented Mar 24, 2025

Added the new helper function as well

@Luap99 Luap99 merged commit cfeba44 into containers:main Mar 24, 2025
10 checks passed
@Luap99 Luap99 deleted the docker-http-err branch March 24, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants