Running together with kubernetes-plugin prevents ANSI Color from working
See original GitHub issueHere’s my simple pipeline DSL:
pipeline {
agent any
options {
ansiColor('xterm')
}
stages {
stage('Run') {
steps {
echo '\033[32mcolored output\033[0m'
}
}
}
}
When run on the leader (I changed the no of executors of leader to 1 for this), I get this output:

Reverting back the executors to zero so that the agent run on Kubernetes pods, this is the build output:

Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:15
Top Results From Across the Web
AnsiColor | Jenkins plugin
This plugin adds support for standard ANSI escape sequences, including color, to Console Output. This plugin is available here and has a ...
Read more >Create A CI/CD Pipeline With Kubernetes and Jenkins
Pipelines ensure a smooth transition from code to the target environment. Here's a how to for building a CICD pipeline with Jenkins and...
Read more >Pipeline Examples - GitHub Pages
This shows usage of a simple build wrapper, specifically the AnsiColor plugin, which adds ANSI coloring to the console output.
Read more >sbt Reference Manual — Combined Pages
Install Scala plugin on the Plugins tab. To use the BSP approach, do not use Open button on the Project tab: IntelliJ; From...
Read more >Removing ANSI color codes from text stream - Super User
I suppose the best way would be to pipe the output through a stream editor of sorts. The following does not work perl...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I finally got to setting up a totally fresh Jenkins instance together with a k8s cluster using the same setup @frezbo provided. This indeed makes logs show raw escape sequences.
After digging a bit deeper and comparing different run results it turned out that the reason lies in
kubernetes-pluginand is very similar to #193. The plugin swallows up someConsoleNotes and preventsansicolorfrom working correctly.A fix should be available in the coming days.
There is a way to get back colored output immediately though (at least for the time being) - install
timestamper-plugin(you don’t have to use it in any way). It triggers the workaround implemented for #193 and it will also help in this case until a new version is out.I can also confirm the workaround fixes ansible color output. Thanks!