mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-21 14:55:51 +00:00
Update Jenkinsfile
This commit is contained in:
parent
2593ed00e5
commit
b6c037e803
1 changed files with 35 additions and 33 deletions
68
Jenkinsfile
vendored
68
Jenkinsfile
vendored
|
@ -1,44 +1,46 @@
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
try {
|
node {
|
||||||
notifyBuild('STARTED')
|
try {
|
||||||
|
notifySlack('STARTED')
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
sh './mvnw package'
|
sh './mvnw package'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Testing') {
|
stage('Testing') {
|
||||||
steps {
|
steps {
|
||||||
echo 'Testing'
|
echo 'Testing'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Package') {
|
stage('Package') {
|
||||||
steps {
|
steps {
|
||||||
echo 'Packaging'
|
echo 'Packaging'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
steps {
|
steps {
|
||||||
echo 'Deploying'
|
echo 'Deploying'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// If there was an exception thrown, the build failed
|
||||||
|
currentBuild.result = "FAILED"
|
||||||
|
throw e
|
||||||
|
} finally {
|
||||||
|
// Success or failure, always send notifications
|
||||||
|
notifySlack(currentBuild.result)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
}
|
||||||
// If there was an exception thrown, the build failed
|
|
||||||
currentBuild.result = "FAILED"
|
|
||||||
throw e
|
|
||||||
} finally {
|
|
||||||
// Success or failure, always send notifications
|
|
||||||
notifyBuild(currentBuild.result)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def notifyBuild(String buildStatus = 'STARTED') {
|
def notifySlack(String buildStatus = 'STARTED') {
|
||||||
// build status of null means successful
|
// build status of null means successful
|
||||||
buildStatus = buildStatus ?: 'SUCCESSFUL'
|
buildStatus = buildStatus ?: 'SUCCESSFUL'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue