containerd/remotes
Justin Chadwell 9f6058d029 pushWriter: correctly propagate errors
In the refactor from 926b9c72f61b5be6bf8d952512f1d0932fbaf898, the error
handling was substantially reworked, and changed the types of errors
returned.

Notably, in the case of a network error, instead of propogating the
error through to return from pushWriter.Write (as previously), it would
be propagated through to pushWriter.Commit - however, this is too late,
since we've already closed the io.Pipe by the time we would have reached
this function. Therefore, we get the generic error message  "io:
read/write on closed pipe" for *every network error*.

This patch corrects this behavior to ensure that the correct error
object is always returned as early as possible, by checking the error
result after writing and detecting a closed pipe.

Additionally, we do some additional hardening - specifically we prevent
falling through when resetting the content or detecting errors, and
update the tests to explicitly check for the ErrReset message.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-01-24 11:37:41 +00:00
..
docker pushWriter: correctly propagate errors 2023-01-24 11:37:41 +00:00
errors Improve ErrUnexpectedStatus default string 2022-03-07 09:46:25 +01:00
handlers_test.go Add image handler to skip non-distributable blobs. 2022-01-11 00:49:36 +00:00
handlers.go Change PushContent to require only Provider 2022-12-06 17:33:33 +00:00
resolver.go remotes: add FetcherByDigest for fetching blobs without foreknown descriptors 2022-11-04 11:41:07 +09:00