#!groovy
@Library('jenkinslib@master') _
String workspace = "/opt/jenkins/workspace"
pipeline {
agent {
node {
label "master"
customWorkspace "${workspace}"
}
}
options {
timestamps()
skipDefaultCheckout()
disableConcurrentBuilds()
timeout(time: 1, unit: "HOURS")
}
stages {
stage("GetCode") {
steps{
timeout(time: 5, unit: "MINUTES") {
script{
println('获取代码')
}
}
}
}
stage("Build") {
steps {
timeout(time: 20, unit: "MINUTES") {
script {
print('应用打包')
}
}
}
}
stage("CodeScan") {
steps {
timeout(time: 30, unit: "MINUTES") {
script {
print("代码扫描")
}
}
}
}
}
post {
always {
script {
print("always")
}
}
success {
script {
currentBuild.description += "\n 构建成功"
}
}
failure {
script {
currentBuild.description += "\n 构建失败"
}
}
aborted {
script {
currentBuild.description += "\n 构建取消"
}
}
}
}