mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-21 23:05:50 +00:00
testing 4
This commit is contained in:
parent
eb8d0bb158
commit
1ad96d48b3
1 changed files with 32 additions and 2 deletions
34
Jenkinsfile
vendored
34
Jenkinsfile
vendored
|
@ -1,6 +1,7 @@
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
stages {
|
stages {
|
||||||
|
notifySlack('STARTED')
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
echo 'build'
|
echo 'build'
|
||||||
|
@ -9,8 +10,37 @@ pipeline {
|
||||||
|
|
||||||
}
|
}
|
||||||
post{
|
post{
|
||||||
always {
|
failure{
|
||||||
slackSend (message: "${buildStatus} ${env.JOB_NAME} [${env.BUILD_NUMBER}] (${env.BUILD_URL})")
|
currentBuild.result = "FAILED"
|
||||||
|
}
|
||||||
|
always{
|
||||||
|
notifySlack(currentBuild.result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def notifySlack(String buildStatus = 'STARTED') {
|
||||||
|
// build status of null means successful
|
||||||
|
buildStatus = buildStatus ?: 'SUCCESSFUL'
|
||||||
|
|
||||||
|
// Default values
|
||||||
|
def colorName = 'RED'
|
||||||
|
def colorCode = '#FF0000'
|
||||||
|
def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
|
||||||
|
def summary = "${subject} (${env.BUILD_URL})"
|
||||||
|
|
||||||
|
// Override default values based on build status
|
||||||
|
if (buildStatus == 'STARTED') {
|
||||||
|
color = 'YELLOW'
|
||||||
|
colorCode = '#FFFF00'
|
||||||
|
} else if (buildStatus == 'SUCCESSFUL') {
|
||||||
|
color = 'GREEN'
|
||||||
|
colorCode = '#00FF00'
|
||||||
|
} else {
|
||||||
|
color = 'RED'
|
||||||
|
colorCode = '#FF0000'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send notifications
|
||||||
|
slackSend (color: colorCode, message: summary)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue