driver/docker-container: remove uses of jsonmessage#3777
driver/docker-container: remove uses of jsonmessage#3777thaJeztah wants to merge 1 commit intodocker:masterfrom
Conversation
This function was always using `io.Discard` for printing the progress, so we can use the `Wait()` method, which reads the stream, returning any error (similar to jsonmessage.DisplayJSONMessagesStream), and closes the stream either if the context is cancelled, or if the stream ends. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| return err | ||
| } | ||
| defer resp.Close() | ||
| return jsonmessage.DisplayJSONMessagesStream(resp, io.Discard, 0, false, nil) |
There was a problem hiding this comment.
#2988 changed this code path to explicitly read the pull JSON stream and return any errorDetail entries from the daemon.
That behavior matters because images/create can return 200 OK and then report the real failure later in the streamed JSON response, which is the bug fixed in moby/moby#49453
The current implementation still preserves that because DisplayJSONMessagesStream() returns jm.Error from the stream:
buildx/vendor/github.com/moby/moby/client/pkg/jsonmessage/jsonmessage.go
Lines 116 to 144 in 182f1f4
buildx/vendor/github.com/moby/moby/client/pkg/jsonmessage/jsonmessage.go
Lines 186 to 200 in 182f1f4
By contrast, resp.Wait(ctx) only returns decoder/context errors and does not inspect jsonstream.Message.Error at all:
buildx/vendor/github.com/moby/moby/client/internal/jsonmessages.go
Lines 47 to 83 in 182f1f4
So this change looks like a regression of #2988: pull failures reported via streamed errorDetail would be silently ignored again, and bootstrap would fall through to a later, less accurate error.
Hm.. good catch; I think that's a bug! Let me move this one to draft, and look at that implementation. |
This function was always using
io.Discardfor printing the progress, so we can use theWait()method, which reads the stream, returning any error (similar to jsonmessage.DisplayJSONMessagesStream), and closes the stream either if the context is cancelled, or if the stream ends.