Jenkins Pipeline从ansiColor插件中记录了括号? [英] Jenkins Pipeline logs braces from ansiColor plugin?

查看:662
本文介绍了Jenkins Pipeline从ansiColor插件中记录了括号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不喜欢这样,当我使用ansiColor插件输出消息时,它会打印很多额外的花括号和单词.如何解决?

I do not like that when I output a message using a ansiColor plug-in, it prints a lot of extra braces and words. How to fix it?

Jenkins管道方法:

Jenkins Pipeline Method:

def printVariable(String message) {
ansiColor('xterm') {
    echo "\033[34m ${message} \033[0m"
}
}

致电:

printVariable("ENVIRONMENT: ${ENVIRONMENT}")
printVariable("PROJECT_VERSION: ${PROJECT_VERSION}")
printVariable("TAG_NAME: ${TAG_NAME}")

输出:

[Pipeline] }
[Pipeline] // ansiColor
[Pipeline] ansiColor
[Pipeline] {
[Pipeline] echo
 ENVIRONMENT: prod 
[Pipeline] }
[Pipeline] // ansiColor
[Pipeline] ansiColor
[Pipeline] {
[Pipeline] echo
 PROJECT_VERSION: 1.0.0 
[Pipeline] }
[Pipeline] // ansiColor
[Pipeline] ansiColor
[Pipeline] {
[Pipeline] echo
 TAG_NAME: repo.bla.bla
[Pipeline] }
[Pipeline] // ansiColor
[Pipeline] ansiColor
[Pipeline] {
[Pipeline] echo

我希望它像这样.

ENVIRONMENT: prod
PROJECT_VERSION: 1.0.0 
TAG_NAME: repo.bla.bla

感谢您的帮助.

推荐答案

我们使用管理Jenkins>配置系统"安装了此插件,然后导航到主题"并添加了额外的CSS,则可以执行此操作.

We use the Simple Theme plugin to hide or surpress the pipeline annotated lines. With this you can use custom .css code to hide or don't display the pipeline annotated lines. You can do this if you have or installed this plugin via 'Jenkins > Manage Jenkins > Configure System' and navigate to 'Theme' and add Extra CSS.

例如,这不应显示管道注释行:

For example this should not display the pipeline annotated lines:

.pipeline-annotated {
   display: none;
}

或将其隐藏(有时会更易于阅读):

or just hide it (this will sometimes be more readable):

.pipeline-annotated {
   visibility: hidden;
}

另请参见

See also this for more info.

这篇关于Jenkins Pipeline从ansiColor插件中记录了括号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆