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

Colorizing bash commands run under Jenkins #105

Closed
ssbarnea opened this issue Mar 24, 2017 · 3 comments
Closed

Colorizing bash commands run under Jenkins #105

ssbarnea opened this issue Mar 24, 2017 · 3 comments
Labels
feature request ✨ New feature to be added wontfix

Comments

@ssbarnea
Copy link

Yes, I know that this could probably be a little bit outside the scope of ANSI-coloring-plugin but I also know that's the best place to meet with others that do share the same need: making Jenkins logs readable, and coloring is probably the best way to do it.

For example I do have about 10 complex regex partterns in iTerm2 which are re-coloring the terminal output. Mainly they detect lines that contain errors, warnings, debug info and they change their colors based on this. Is not perfect but it works very well on manually run commands or even while tailing the logs.

Now, I clearly cannot do the same with jenkins console and I am wondering which approach should be better: find a tool on the client that would act as a wrapper for the executed command or allow ANSIColor plugin (or another one) to do this parsing. Ideally it should be possible to disable any pattern matching if the line already contains some ANSI codes.

I will give few examples here, in case someone else would find them useful

^.*(\[*(warning|WARN|warn|Warning|WARNING).*)$
^.*((INFO|TASK)[\s\t]?.*)$
^(#|* |INFO|notice|remote|hint|debug1|debug2|debug3).*
^(error|fatal|abort|E):.*
# debug
^.*([\[\s]+(DEBUG)[:]?.*)
# dark grey (bash verbose lines)
^\+.*
# special trigger which triggers a terminal notification (ansible playbook ends)
PLAY RECAP \*\*\*
@ben8p
Copy link

ben8p commented Nov 23, 2018

I think I came across the same need.
From jenkins, I run an sh command sh doSomething
This command output �[33m�[1mDone�[22m�[39m
In a normal bash. I can see the colors. But not in the jenkins console, even when using ansicolor-plugin
In Jenkins, I see the text with the colors code (exactly as displayed above).

Is there a way to parse the stdout and apply the colors to it ?

@ben8p
Copy link

ben8p commented Dec 20, 2018

Quick update:
We got a new jenkins server (2.150.1) and with ansiColor 0.6.0 it works like a charm. I can see the colors emitted by the bash...
Now I am thinking: Maybe it was a miss-configuration: something like wrong encoding when reading stdout...

@tszmytka tszmytka added feature request ✨ New feature to be added and removed needs more info 💤 labels May 16, 2021
@stale
Copy link

stale bot commented Oct 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 2, 2021
@stale stale bot closed this as completed Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request ✨ New feature to be added wontfix
Projects
None yet
Development

No branches or pull requests

4 participants