feat!: stream image build, pull and push progress - #25
Merged
Merged
Conversation
images.build, images.pull and images.push returned nil and drained the response, so their logs were lost and a failed build went unnoticed: Docker reports it with status 200 and an error in the last line of the stream. They now read the stream to the end, yield each typed message (BuildInfo, CreateImageInfo, PushImageInfo) to an optional block and raise Errors::StreamError when the daemon reports a failure. Reading to the end is kept on purpose: a lazily returned stream left unread could cut a pull short. BuildKit sends its progress as base64 protobuf StatusResponse messages in BuildInfo#aux; Helpers::BuildkitStatus decodes the fields a log needs and PlainPrinter renders them as --progress=plain does. Union#coerce also kept the error of a failed variant attempt after a later variant matched, so reading BuildInfo#aux as a String raised. BREAKING CHANGE: images.build, images.pull and images.push raise Errors::StreamError on a failure reported inside the stream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Open
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
images.build,images.pullandimages.pushreturnedniland drained the response, so their progress was lost and a failed build went unnoticed. Docker reports a build failure with status 200 and an error in the last message:Errors::StreamError(withdetail) onerrorDetailor the legacyerror. They still read to the end without a block, because a lazily returned stream left unread could cut a pull short.BuildInfo,CreateImageInfo,PushImageInfo,ErrorDetail,ProgressDetailandImageID, from the definitions in the Engine API.BuildInfo#auxisImageID | String: the classic builder sends an image id, BuildKit a trace.Internal::JSONLStream. The existingrequest(stream:)now gets the raw lines, because Docker sends its progress streams asapplication/jsonanddecode_contentwould join them into one document.Helpers::BuildkitStatus.decodereads the base64 protobufStatusResponse(moby/buildkitcontrol.proto): vertexes and logs.PlainPrinterrenders it as--progress=plaindoes:Union#coerce. The error of a failed variant attempt survived a later variant matching, so readingBuildInfo#auxas aStringraised. Each attempt now starts clean, and the chosen alternative keeps its own error.Checked against Docker Engine 29.8 (API 1.56): pull, a BuildKit build with its log, a failing build raising
StreamError, and a push to a localregistry:2. The BuildKit test decodes messages captured from that daemon.rake lint(rubocop, Sorbet, Steep) andrake test(189 runs, 0 failures) pass.🤖 Generated with Claude Code