当我使用ansiColor插件输出消息时,我不喜欢它,它会打印很多额外的花括号和单词。如何解决?
詹金斯管道方法:
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
谢谢您的帮助。
我们使用“ 简单主题”插件来隐藏或隐藏管道注释的行。这样,您可以使用自定义.css代码隐藏或不显示管道注释的行。如果您已经通过“ Jenkins>管理Jenkins>配置系统”安装了此插件,然后导航至“主题”并添加Extra CSS,则可以执行此操作。
例如,这不应显示管道注释行:
.pipeline-annotated { display: none; }
或只是将其隐藏(有时会更具可读性):
.pipeline-annotated { visibility: hidden; }
另请参阅此以获取更多信息。