jenkins2 pipeline 语法快速参考

jenkins2 pipeline中常用的语法快速参考。

文章来自:http://www.ciandcd.com
文中的代码来自可以从github下载: https://github.com/ciandcd

来自:

Using the Pipeline Plugin to Accelerate Continuous Delivery — Part 1
Using the Pipeline Plugin to Accelerate Continuous Delivery — Part 2
Using the Pipeline Plugin to Accelerate Continuous Delivery — Part 3

完整实例:

stage 'build'
node {
git 'https://github.com/cloudbees/todo-api.git'
withEnv(["PATH+MAVEN=${tool 'm3'}/bin"]) {
sh "mvn -B –Dmaven.test.failure.ignore=true clean package"
}
stash excludes: 'target/', includes: '**', name: 'source'
}
stage 'test'
parallel 'integration': {
node {
unstash 'source'
withEnv(["PATH+MAVEN=${tool 'm3'}/bin"]) {
sh "mvn clean verify"
}
}
}, 'quality': {
node {
unstash 'source'
withEnv(["PATH+MAVEN=${tool 'm3'}/bin"]) {
sh "mvn sonar:sonar"
}
}
}
stage 'approve'
timeout(time: 7, unit: 'DAYS') {
input message: 'Do you want to deploy?', submitter: 'ops'
}
stage name:'deploy', concurrency: 1
node {
unstash 'source'
withEnv(["PATH+MAVEN=${tool 'm3'}/bin"]) {
sh "mvn cargo:deploy"
}
} 语法参考卡:
基本:

jenkins2 pipeline 语法快速参考

高级:

jenkins2 pipeline 语法快速参考

文件操作:

jenkins2 pipeline 语法快速参考

流程控制:

jenkins2 pipeline 语法快速参考

docker:

jenkins2 pipeline 语法快速参考

上一篇:Java 8 的 JVM 有多快?Fork-Join 性能基准测试


下一篇:Linux重定向: > 和 &> 区别