mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-21 14:55:51 +00:00
fixing bugs
This commit is contained in:
parent
b6c037e803
commit
5556822705
1 changed files with 24 additions and 62 deletions
86
Jenkinsfile
vendored
86
Jenkinsfile
vendored
|
@ -1,67 +1,29 @@
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
node {
|
stages {
|
||||||
try {
|
stage('Build') {
|
||||||
notifySlack('STARTED')
|
steps {
|
||||||
|
sh './mvnw package'
|
||||||
stages {
|
|
||||||
stage('Build') {
|
|
||||||
steps {
|
|
||||||
sh './mvnw package'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Testing') {
|
|
||||||
steps {
|
|
||||||
echo 'Testing'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Package') {
|
|
||||||
steps {
|
|
||||||
echo 'Packaging'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Deploy') {
|
|
||||||
steps {
|
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
stage('Testing') {
|
||||||
|
steps {
|
||||||
def notifySlack(String buildStatus = 'STARTED') {
|
echo 'Testing'
|
||||||
// build status of null means successful
|
}
|
||||||
buildStatus = buildStatus ?: 'SUCCESSFUL'
|
}
|
||||||
|
|
||||||
// Default values
|
stage('Package') {
|
||||||
def colorName = 'RED'
|
steps {
|
||||||
def colorCode = '#FF0000'
|
echo 'Packaging'
|
||||||
def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
|
}
|
||||||
def summary = "${subject} (${env.BUILD_URL})"
|
}
|
||||||
|
|
||||||
// Override default values based on build status
|
stage('Deploy') {
|
||||||
if (buildStatus == 'STARTED') {
|
steps {
|
||||||
color = 'YELLOW'
|
echo 'Deploying'
|
||||||
colorCode = '#FFFF00'
|
}
|
||||||
} else if (buildStatus == 'SUCCESSFUL') {
|
}
|
||||||
color = 'GREEN'
|
}
|
||||||
colorCode = '#00FF00'
|
slackSend "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})"
|
||||||
} else {
|
|
||||||
color = 'RED'
|
|
||||||
colorCode = '#FF0000'
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send notifications
|
|
||||||
slackSend (color: colorCode, message: summary)
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue