Skip to content
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

--no-progress replaced with --progress #504

Merged
merged 1 commit into from
Aug 29, 2018

Conversation

kunalkushwaha
Copy link
Collaborator

Fixes #443

Signed-off-by: Kunal Kushwaha kushwaha_kunal_v7@lab.ntt.co.jp

Usage: "Don't show interactive progress",
Name: "console",
Usage: "Show console output",
Hidden: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it hidden?

Also, shouldn't this default to true so the autodetection of a tty on stdio and, if possible, the fancy output, happens by default? (Maybe s/Hidden/Default/g is what you meant?).

Copy link
Collaborator Author

@kunalkushwaha kunalkushwaha Jul 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Hidden was meant for Default. Since BoolFlag had no field Value or Default so I used Hidden.

[Update]: I replaced BoolFlag with BoolTFlag, so default is true and in case of Stdio is not terminal, it will just send the build log on output channel.

@kunalkushwaha kunalkushwaha force-pushed the no-console branch 2 times, most recently from 1d80771 to 99920a5 Compare July 17, 2018 04:38
@tonistiigi
Copy link
Member

ping @tiborvass

@@ -206,7 +206,7 @@ func build(clicontext *cli.Context) error {

eg.Go(func() error {
var c console.Console
if !clicontext.Bool("no-progress") {
if clicontext.Bool("console") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can keep no-progress as a hidden flag for compatibility

@thaJeztah
Copy link
Member

Is auto still an option? Looking at #443 (comment), the reason for naming it --console instead of --no-console was because the flag accepted three values; auto, false, true. If that's no longer the case, --no-console would be more convenient, and would make the boolean's default value ("false") also the default state

@kunalkushwaha
Copy link
Collaborator Author

Will update the PR for --console as three value flag (auto, true, false)

@kunalkushwaha
Copy link
Collaborator Author

@thaJeztah Now buildkit build --console have same behaviour as docker build --console

@tiborvass
Copy link
Collaborator

@kunalkushwaha Thank you for your PR and sorry for the delay in answering. I wasn't super happy about --console=false. I'd prefer --console [auto|plain|rich], hopefully that makes more sense. Let me know what you think. Will update in docker CLI too.

cc @AntaresS

@tonistiigi
Copy link
Member

@tiborvass Why is called console then? What does "rich" mean? Why is that if I want to get more output I need to use "plain" and if I only want the command names I use "rich" (I assume this is how they map).

@kunalkushwaha
Copy link
Collaborator Author

rich & plain will be more confusing with console flag.
I guess from rich you meant interactive (progress bar) whereas plain is just log of build progress, which someone may want even terminal is there.

If we want to give user that option, its better to give new output flag as rich|plain, which will be valid in case of console=auto|true

@tiborvass
Copy link
Collaborator

@tonistiigi because it controls the way the console is used for output. I get your point about rich having less information than plain.

How about --pretty=[auto|true|false] ? Pretty is often associated with colors, so we could assume users will understand that this flag can be turned off to make it less pretty, in exchange for more information?

@tonistiigi
Copy link
Member

How about --pretty=[auto|true|false]

This seems to almost counter the previously proposed logic. How would you explain pretty=auto.

Pretty is often associated with colors,

Yes, but in BuildKit this has very little to do with colors. The two outputs are for different use-cases and contain different data, not for people who prefer coloring and who don't.

@tonistiigi
Copy link
Member

My main issue with previous is that I don't think there is such a thing as a rich console. Or at least that name does not indicate the actual behavior of the flag.

@tianon
Copy link
Member

tianon commented Aug 3, 2018

This was a huge source of confusion for me -- IMO, this flag is currently controlling two separate behaviors. One is build verbosity and the other is progress / "re-writing" output (which wouldn't be awful to have even in the verbose case, it just isn't as necessary).

@tiborvass
Copy link
Collaborator

tiborvass commented Aug 3, 2018

@tianon the problem comes from the fact that showing RUN output in parallel in the "rewriting" output, is a really hard problem to solve. It's not impossible we'll have a solution but right now it's clearly out of the picture.

What would have helped to lower the confusion? A --show-logs flag that would conflict if the progress output is chosen? With a nice message explaining that right now that only works with --no-progress mode ?

Btw, the other problem I see with the "progress" name is that it's not like --no-progress doesn't show progress, it shows it differently, in a plain text mode.

I'd be happy to hear more suggestions.

@tonistiigi

Yes, but in BuildKit this has very little to do with colors. The two outputs are for different use-cases and contain different data, not for people who prefer coloring and who don't.

Since we're changing the way we display data... --display ?

I'm super close to being out of ideas.

@tianon
Copy link
Member

tianon commented Aug 4, 2018

the problem comes from the fact that showing RUN output in parallel in the "rewriting" output, is a really hard problem to solve. It's not impossible we'll have a solution but right now it's clearly out of the picture.

Totally understood, and agree. ❤️

What would have helped to lower the confusion?

Honestly, even just a little bit more documentation would've helped a ton. All I had to go on was the following:

  --console  Show console output (with buildkit only) (true, false, auto) (default auto)

I was wanting the console output of my RUN lines, so naturally I tried --console=true, when in fact what I wanted was the exact opposite.

I think it needs to be clear that this flag (whatever it's named) affects the amount of information displayed as well as the way that information is displayed.

Having one flag that controls terse vs verbose and a separate flag that controls whether we use control codes would be a really good idea IMO (and for now, like you said, having the control codes be temporarily incompatible with the verbose output with an error).

For other software, this usually exhibits as a flag to explicitly disable TTY detection (or explicitly force TTY behavior) like --color=never, --color=always, --color=auto, but as you mentioned this doesn't really have to do with colors and if we mention TTYs we might create more confusion ("is this flag providing a TTY to my RUN lines?"), so we're in a bit of a hard spot.

All that being said, I think --progress is less confusing than --console (since "console" is an ambiguous term in this case, and that ambiguity combined with the lack of documentation is what created my confusion in the first place).

@tiborvass
Copy link
Collaborator

@tianon thank you so much for your feedback!

@tonistiigi just suggested to me --progress=[auto|plain|tty]. I'm hopeful that with that and a description detailing the fact that exec logs will currently only be shown in plain mode, the UX will be much better.

@kunalkushwaha @tianon @AkihiroSuda @AntaresS what do you think?

@AntaresS
Copy link
Contributor

AntaresS commented Aug 4, 2018

I think it needs to be clear that this flag (whatever it's named) affects the amount of information displayed as well as the way that information is displayed.

I agree with @tianon's point. After reading the whole thread, I think the foundamental question is we want the meaning of this flag to clearly tell users what type of content they are willing to see. Hence, thinking from user perspective I'd prefer either --display or --progress if they are well documented.

idea 1 using --display Sets how buildkit output should look like

--display=[auto|plain|progress]

idea 2 using --progress

--progress=[auto|plain|pretty]

cc @tiborvass

@kunalkushwaha
Copy link
Collaborator Author

--progress=[auto|plain|tty]. I'm hopeful that with that and a description detailing the fact that exec logs will currently only be shown in plain mode, the UX will be much better.

For now it sounds good.

showing RUN output in parallel in the "rewriting" output, is a really hard problem to solve. It's not impossible we'll have a solution but right now it's clearly out of the picture.

For better UX, Will apt install kind of output suitable here? i.e. Showing whole build logs in all cases and progress bar at bottom of screen in case tty is attached?.

@tiborvass @tonistiigi @AkihiroSuda

@tiborvass
Copy link
Collaborator

FYI I opened docker/cli#1276

@kunalkushwaha
Copy link
Collaborator Author

Updated as per docker/cli#1276

c = cf
}
progressOpt := clicontext.String("progress")
if !(progressOpt == "auto" || progressOpt == "tty" || progressOpt == "plain") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit, but would you mind doing progressOpt != ... && progressOpt != ... ? I think it's easier to read.

@tiborvass
Copy link
Collaborator

@kunalkushwaha thanks! Apart from small nit, I'm ready to merge this :)

@tiborvass tiborvass changed the title --no-progress replaced with --console --no-progress replaced with --progress Aug 17, 2018
@tiborvass
Copy link
Collaborator

@kunalkushwaha also would you mind updating the commit message?

@kunalkushwaha
Copy link
Collaborator Author

kunalkushwaha commented Aug 17, 2018 via email

@kunalkushwaha
Copy link
Collaborator Author

Updated PR as per suggestion.

}
if cf, err := console.ConsoleFromFile(os.Stderr); err == nil && (progressOpt == "auto" || progressOpt == "tty") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what situations do errors occur here? Is an error only generated if "no console" is present (so, ok to ignore if "auto" is selected), or are there other situations?

What if "tty" is selected, and an error occurs? Should that error be returned?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also wondering if a switch would be slightly clearer; doing so would also prevent running console.ConsoleFromFile() if not needed (i.e., if "plain" was used as option);

switch clicontext.String("progress") {
case "auto", "tty":
	cf, err := console.ConsoleFromFile(os.Stderr)
	if err != nil {
		return err
	}
	c = cf
case "plain":
default:
	return errors.New("Invalid progress value")
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right now, error is not returned if tty is option and is failback on plain.
I will update it as per suggestion.

@kunalkushwaha
Copy link
Collaborator Author

Fixed as per suggestion.

  • return error only in case of tty as auto should fallback to plain output.

c = cf
case "plain":
default:
return errors.New("Invalid progress value")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: lowercase errors

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also print the value in the error message

this make buildctl build output options same as moby.

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
Copy link
Collaborator

@tiborvass tiborvass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tiborvass tiborvass merged commit 17e6416 into moby:master Aug 29, 2018
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, forgot to update my review

post-merge LGTM, thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants