pipeline {
agent any
options {
timestamps() //日志会有时间
skipDefaultCheckout() // 删除隐式checkout scm语句
disableConcurrentBuilds() // 禁止并行
timeout(time: 1, unit: 'HOURS') // 超时时间
}
stages {
stage('GetCode') {
steps {
timeout(time:5, unit:"MINUTES"){
script{
println("get the code")
}
}
}
}
stage('Build') {
steps {
timeout(time:20, unit:"MINUTES"){
script{
println("build package")
}
}
}
}
stage('CodeScan') {
steps {
timeout(time:30, unit:"MINUTES"){
script{
println("get the code")
}
}
}
}
}
post {
always {
script {
println("always");
}
}
success {
script {
currentBuild.description += "success!"
}
}
failure {
script {
currentBuild.description += "fail!"
}
}
aborted {
script {
currentBuild.description += "abort!"
}
}
}
}