jenkinsfile
作者:互联网
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!"
}
}
}
}
标签:script,currentBuild,timeout,time,println,unit,jenkinsfile 来源: https://www.cnblogs.com/swnm/p/15652548.html