Open LucianBuzzo opened 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...
@memory the --logs
option makes all logs print sequentially: https://www.balena.io/docs/reference/cli/#-logs
Yes, but even with the --logs
flag, there is an animated "progress bar" for both the "Creating release" and "Push" steps:
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:
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
@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):
@pdcastro Should this feature be implemented with it's own flag, or incorporated in a general non-interactive flag?
@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.
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.
@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?
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.
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. :)
[pdcastro] This issue has attached support thread https://jel.ly.fish/a675f6e4-6dcf-4de9-a566-a6e52da23104
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.
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.