jenkins-pipelinejenkins-pluginsjenkins-groovycicdansi-colors

exist any way to get a simple global config for ansiColor var for outputs/steps build jop pipeline results?


exist any way to get a global ansiColor var for outputs/steps build jop results? I showed results all text in black color.

Objetive: Show diferents blocks results in a diferents colors

Thanks in advance

Regards, Edu < allways learning


Solution

  • Two step process:

    1. Install ansicolor plugin and enable it globally
    2. Add ANSI escape codes to your echo statements

    In the most basic way it would be like this:

    echo 'Some \033[1m bold \033[0m text'
    

    obviously you can create constants for different codes, define wrapper methods - the sky is the limit.