fix: read the image id from a quiet build - #489
Merged
Conversation
Fixes #225. `docker build -q` prints the id on a line of its own and nothing else -- no step lines, no "exporting to image", none of the wording parse_image_id matches on. So `build_options: -q` never produced an instance; it failed with Could not parse Docker build output for image ID after the image had already been built. A line that is nothing but a digest is now read as the id. It has to be the whole line: ordinary build output is full of "... sha256:... done" lines, and matching a digest anywhere would pick one of those instead. The fixture is captured from a real `docker build -q` on 29.7.2, as the others in that file are. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tas50
force-pushed
the
fix/quiet-build-image-id
branch
from
August 23, 2026 19:44
a264811 to
6ebe0a2
Compare
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.
Fixes #225 — nine years old and still reproducible.
The bug
docker build -qprints the id on a line of its own and nothing else:No step lines, no
exporting to image, nowriting image, nonaming to, noSuccessfully built— none of the wordingparse_image_idmatches on. So every pattern missed, andbuild_options: -qfailed after the image had already been built:The fix
A line that is nothing but a digest is read as the id.
It has to be the whole line. Ordinary build output is full of
#6 exporting manifest sha256:... donelines, so matching a digest anywhere would pick one of those instead — there is a spec pinning that.The fixture is captured from a real
docker build -qon 29.7.2, like the others inspec/support/docker_output.rb.Confirmation
Docker 29.7.2 (Docker Desktop 4.87.0, macOS/arm64), Test Kitchen 4.1.1, real
ubuntu-24.04container,driver: {build_options: -q}.Before:
After:
Ordinary (non-
-q) builds still parse — checked in the same run.rake styleclean;rspec316 examples, 0 failures (3 new).