balena-io / balena-cli

The official balena CLI tool.
Apache License 2.0
452 stars 138 forks source link

Add option to suppress unicorn output when running resin deploy #1001

Open LucianBuzzo opened 5 years ago

LucianBuzzo commented 5 years ago

This should be as simple as parsing and additional flag in this block https://github.com/resin-io/resin-cli/blob/master/lib/actions/deploy.coffee#L113 Perhaps a flag --no-unicorn or -no would work.

Front logo Front conversations

Front logo Front conversations

memory commented 5 years ago

actually while you're here, implementing a general suppression of "active" output would be great: the "progress bar" indicator looks great when being used interactively, but results in endless lines of spew when run from something that isn't a full vt100/xterm device, e.g. the logs of a CI system that uses the resin cli...

dfunckt commented 5 years ago

@memory the --logs option makes all logs print sequentially: https://www.balena.io/docs/reference/cli/#-logs

memory commented 5 years ago

Yes, but even with the --logs flag, there is an animated "progress bar" for both the "Creating release" and "Push" steps:

image

That's nifty inside an xtermish console, but in the context of a build system that's just capturing stdout to a file, it ends up looking like this:

image

memory commented 5 years ago

Hi, has there been any progress on this? If the cli weren't written in typescript I'd try to wrangle a PR myself. :)

cc: @pcarranzav

pdcastro commented 5 years ago

@memory, work has not started on this feature yet, but I'm labelling it high priority as it is easily justifiable and relatively easy to implement. By the way, this seems to be a particular case of a more generic feature that we would like to implement throughout the CLI (all commands):

1089 Implement scriptable (non-interactive) mode

srlowe commented 4 years ago

@pdcastro Should this feature be implemented with it's own flag, or incorporated in a general non-interactive flag?

codewithcheese commented 4 years ago

@memory @srlowe Perhaps the unicorn and animation can be shown only to terminal devices. This should be achievable with a conditional on process.stdout.isTTY. That way no extra flag necessary.

memory commented 4 years ago

Beware, that's not foolproof: CI tools such as Jenkins executors and Vagrant often fake having a tty. (see for example https://github.com/pypa/pip/issues/2756)

A flag or environment variable to entirely disable it would be strongly preferable.

codewithcheese commented 4 years ago

@memory Thanks for raising my attention to those cases, I see your point. If you were to implement the solution. What would you name the flag and what would be the behavior?

pdcastro commented 4 years ago

If you were to implement the solution. What would you name the flag and what would be the behavior?

Related to this discussion, in issue #1089 Implement scriptable (non-interactive) mode, I suggested common flags (that applied to all CLI commands) in order to both explicitly enable and disable interactive mode, with the behaviour described there, including disabling auto TTY detection. Auto TTY detection is interesting (and we should implement) if the user neither enables nor disables scriptable mode.

memory commented 4 years ago

I honestly don't have strong feelings on the flag name(s); pypa/pip ended up using --progress-bar=off so maybe that plus a --color=off flag? Or maybe just a --ci_mode boolean flag that disabled all "helpful" text decorations (color, progress bars, ascii art unicorns, etc)? Honestly as long as there's some documented way to do this I'm agnostic. :)

jellyfish-bot commented 4 years ago

[pdcastro] This issue has attached support thread https://jel.ly.fish/a675f6e4-6dcf-4de9-a566-a6e52da23104

ab77 commented 2 years ago

As we begin using balena-cli within CI environments, such as GH Actions, progress bar suppression features become more and more important. Currently, running balena push in an action runner generates barely readable log.