我不确定该如何处理Jenkins声明性流水线。
按照这个例子: https://github.com/jenkinsci/ansicolor-plugin
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {
sh 'something that outputs ansi colored stuff'
}
以上片段应该放在哪里?
这是我的简单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
'''
}
}
}
}
包装器是否围绕阶段?它是围绕每个阶段吗?