question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running together with kubernetes-plugin prevents ANSI Color from working

See original GitHub issue

Here’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:

image

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

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:15

github_iconTop GitHub Comments

4reactions
tszmytkacommented, Aug 24, 2020

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-plugin and is very similar to #193. The plugin swallows up some ConsoleNotes and prevents ansicolor from 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.

0reactions
Kryan90commented, Sep 3, 2020

I can also confirm the workaround fixes ansible color output. Thanks!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found