Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid undesired "animated" console output on Jenkins

Sometimes I find log-lines like these in my Jenkins Job Output:

 [|]   [/]   [-]   [\]   [|]   [/]   [-]   [\]   [|]   [/]   [-]

I know these lines come from a "Progress Spinner" (https://askubuntu.com/questions/623933/how-to-create-a-rotation-animation-using-shell-script) but they look weird in a plain-text log.

It gets worse, when a tool uses a "command line progress bar" which comes e.g. when pulling a Docker Image or an NPM package - then the log contains real ugly (and unnecessary) log blocks.

...
xtracting [=============>                                   ]  15.2 MB/50.31 MB
xtracting [==============>                                  ]  15.2 MB/50.31 MB
xtracting [===============>                                 ]  15.2 MB/50.31 MB
xtracting [================>                                ]  15.2 MB/50.31 MB
xtracting [=================>                               ]  15.2 MB/50.31 MB
----

Is there any Jenkins Plugin existing (like the Ansi-Color Plugin) which either shows the animation or shrinks the output to the final "position" ?

I don't want to use every tool in "quiet" mode just to skip these unnecessary "ascii arts" because a lot of interesting information gets lost then.

like image 464
Christoph Forster Avatar asked Feb 14 '17 15:02

Christoph Forster


1 Answers

This is an interesting subject but I am afraid that there is almost nothing safe you can do to "compress" the output if the tool didn't detect the TTY properly.

Here are the workarounds:

  • Enable a less verbose or quiet mode when you call the tool in order to avoid the progress bars. Look for switches like -q or --silent
  • If the tool is still displaying progress bards when you redirect the output to a file, it is a bug and you should file a bug to that tool.
like image 58
sorin Avatar answered Nov 06 '22 17:11

sorin