更新时间:2023-12-05 13:21:04
AnsiColor插件在控制台输出中添加了对ANSI转义序列(包括颜色)的支持"(
The AnsiColor Plugin "adds support for ANSI escape sequences, including color, to Console Output" (https://wiki.jenkins.io/display/JENKINS/AnsiColor+Plugin). It merely acts as a wrapper so that the Jenkins Console Output correctly displays colors, the plugin itself does not add ANSI escape sequences nor colors to the Console Output.
一个很好的例子是 Ansible插件,其可以使用参数'colorized:true'启用彩色输出"(
A good example is with the Ansible Plugin for which "colorized output can be enabled with the argument 'colorized: true'" (https://wiki.jenkins.io/display/JENKINS/Ansible+Plugin#AnsiblePlugin-ColorizedOutput). The Ansible Plugin's colorized output requires the AnsiColor Plugin else the Jenkins Console Output is incapable of displaying the colors.
没有 AnsiColor插件包装器的彩色输出:
Colorized output without the AnsiColor Plugin wrapper:
stage('build'){
node('master'){
...
ansiblePlaybook colorized: true, installation: 'ansible2.5.11', inventory: 'inventory/hosts', playbook: 'playbooks/example.yml'
}
}
使用 AnsiColor插件包装器进行彩色输出:
Colorized output with the AnsiColor Plugin wrapper:
stage('build'){
node('master'){
...
ansiColor('xterm') {
ansiblePlaybook colorized: true, installation: 'ansible2.5.11', inventory: 'inventory/hosts', playbook: 'playbooks/example.yml'
}
}
}