-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Output logs in color for parallel builds #5014
Output logs in color for parallel builds #5014
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5014 +/- ##
==========================================
+ Coverage 72.11% 72.17% +0.06%
==========================================
Files 365 365
Lines 12773 12823 +50
==========================================
+ Hits 9211 9255 +44
- Misses 2877 2879 +2
- Partials 685 689 +4
Continue to review full report at Codecov.
|
Verified this locally
|
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.
lgtm!
When building in parallel, logs would not show up with colors for builders that had colorful logs.
Also Fixes: #4913
Related: #4990
Description
Wrap the output writer that is passed through skaffold with a "colorful writer" struct. This allows detecting when we should enable printing with colors at any point by checking in color.Fprint(f/ln) if it is a colorful writer.
Because the writer is now wrapped in a struct we are no longer passing os.Stdout raw and so when running commands it will be necessary to force enable/disable coloring with flags when appropriate.
User facing changes
Logs that normally show up in color in a non-parallel build are also in color for builds done in parallel.
Before (master):

Parallel build containing a jib maven artifact
Running
skaffold run --mute-logs=all
in skaffold/examples/rubyIn /var/.../skaffold/deploy/2020-11-02_18-49-06.log
The logs contain ANSI escape codes which do not represent the actual content intended to be logged.
After:

Parallel build containing a jib maven artifact
Running
skaffold run --mute-logs=all
in skaffold/examples/rubyIn /var/.../skaffold/deploy/2020-11-02_18-53-51.log
The only thing logged is the intended output.