-
Notifications
You must be signed in to change notification settings - Fork 609
Implement --quiet support
#740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Andy Caldwell <[email protected]>
Signed-off-by: Andy Caldwell <[email protected]>
Signed-off-by: Andy Caldwell <[email protected]>
|
@tonistiigi - Thanks for the review, I've updated the change (to pass the digest back to the main command driver and manipulate Possibly this is slightly presumptuous - it assumes that the target is called |
| } | ||
|
|
||
| if in.quiet && in.progress != "auto" && in.progress != "quiet" { | ||
| return errors.Errorf("progress=%s and quiet cannot be used together", in.progress) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should be an error. Maybe -q just overrides. Thinking of scripts where different components add their flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking was that explicitly asking for "fancy output"/"streamed output" and "no output" was user-error and should be rejected, can a component add a new --progress type?.
I allowed the user to pass --progress=quiet -q which is (possibly surprisingly) different to passing --progress=quiet on its own (the former doesn't print the digest at the end), since that's not contradictory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought for a case where --progress=plain is used to not detect tty and then another part does not want progress at all.
| respMu.Unlock() | ||
| if len(res) == 1 { | ||
| digest := res[0].ExporterResponse["containerimage.digest"] | ||
| if opt.ImageIDFile != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe error out if digest is empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous code would have written an empty file to --iidfile in this case, changing that to an error would be an externally visible change.
In fact, looking at the code now, none of the changes in this file are actually needed, they're just a refactor due to me originally printing the digest here (and hence pulling the digest out for printing/writing to the --iidfile).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe best in this case would be to always set -o type=image if image id is to be exported, either with iidfile, or q. And error if another conflicting output is already set. This can be follow-up though as strictly related.
|
Thanks for implementing this feature! I was wondering if a release which includes it is in the pipeline? [UPDATE 2021-11-05] Shipped! https://github.com/docker/buildx/releases/tag/v0.7.0-rc1 |
See #621. I needed this in order to script logic of the following structure (where I didn't want to use a temporary file on disk for
--iidfile):This worked unless someone had installed
buildxin place ofdocker build(as I had 😛 ) in which case theimagewas an empty string and thedocker runfailed catastrophically.