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.

Add ansiColor as an option

See original GitHub issue

Instead of wrapping each of the stage() { steps { } } of my Jenkinsfile pipeline with ansiColor('xterm'), is it possible to declare it as a pipeline options https://jenkins.io/doc/book/pipeline/syntax/#options ?

I’m aware that this might require a change deep within Jenkins core, and out of the control of this plugin.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:29
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
brushmatecommented, Mar 22, 2018

For me ansiColor('xterm') is working as an option. But I had to add some additional Maven configuration in order to get colored Maven output:

pipeline {
    agent {
        label 'my-build-node'
    }

    options {
        ansiColor('xterm')
    }

    environment {
        MAVEN_OPTS = '-Djansi.force=true'
    }

    stages {
        stage('Example') {
            steps {
                sh "./mvnw -Dstyle.color=always -B verify"
            }
        }
    }
}
2reactions
agabryscommented, Jan 31, 2020

I would like also to confirm that

options {
    ansiColor('xterm')
}

works. Having this example on:

would be great.

If I’m right then

🙂

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 page...
Read more >
Where to put the wrapper for ansiColor Jenkins plugin in ...
I put this in options section, apply for all stages and steps in pipeline pipeline { agent any options ...
Read more >
Ansi color in jenkins pipelines | Lzone Blog
In all cases ensure you have the ansi-color plugin installed. In Declarative Pipelines. You need to add an option for ansiColor().
Read more >
[#MNG-6220] Add CLI options to control color output - ASF JIRA
If a user wants colored output but no interactivity (ie: jenkins environment with the ansicolor plugin), there is no CLI option combination ...
Read more >
Term::ANSIColor - Color screen output using ANSI escape ...
The most conservative choice is to use only the regular colors, ... colorstrip() was added in Term::ANSIColor 2.01 and colorvalid() was added in ......
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