Eri*_*cis 15 ansi-colors jenkins jenkins-pipeline
我不确定如何处理声明式jenkins管道.
按照这里的例子:https: //github.com/jenkinsci/ansicolor-plugin
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {
sh 'something that outputs ansi colored stuff'
}
Run Code Online (Sandbox Code Playgroud)
上面的代码片段在哪里?
这是我简单的Jenkinsfile:
#!groovy
pipeline {
agent any
// Set log rotation, timeout and timestamps in the console
options {
buildDiscarder(logRotator(numToKeepStr:'10'))
timeout(time: 5, unit: 'MINUTES')
}
stages {
stage('Initialize') {
steps {
sh '''
java -version
node --version
npm --version
'''
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
包装器是否绕过各个阶段?它是围绕每个阶段吗?
Eri*_*cis 33
能够像这样整合选项块中的配置
options {
buildDiscarder(logRotator(numToKeepStr:'10'))
timeout(time: 5, unit: 'MINUTES')
ansiColor('xterm')
}
Run Code Online (Sandbox Code Playgroud)
我在每个阶段都这样放置我的:
stage('Initialize') {
ansiColor('xterm') {
// do stuff
}
}
Run Code Online (Sandbox Code Playgroud)
小智 5
我将其放在选项部分,适用于管道中的所有阶段和步骤
pipeline {
agent any
options {
ansiColor('xterm')
}
...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9601 次 |
| 最近记录: |