added email notifications to Jenkinsfile #38
nclazz/codebuilder/pipeline/head This commit looks good Details

master
Niclas Thobaben 2021-10-21 20:16:34 +02:00
parent 88fe95c856
commit 97c37472b6
1 changed files with 48 additions and 0 deletions

48
Jenkinsfile vendored
View File

@ -29,6 +29,54 @@ pipeline {
}
}
post {
failure {
script {
emailext(
to: "notifications@nclazz.de",
from: "jenkins@nclazz.de",
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} failed",
body: """
There is a build failure in ${env.JOB_NAME}.
Build: ${env.BUILD_URL}
Logs: ${env.BUILD_URL}console
Changes: ${env.BUILD_URL}changes
--
"""
)
}
}
unstable {
script {
emailext(
to: "notifications@nclazz.de",
from: "jenkins@nclazz.de",
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} unstable",
body: """
Some tests have failed in ${env.JOB_NAME}.
Build: ${env.BUILD_URL}
Logs: ${env.BUILD_URL}console
Changes: ${env.BUILD_URL}changes
--
"""
)
}
}
fixed {
script {
emailext(
to: "notifications@nclazz.de",
from: "jenkins@nclazz.de",
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} fixed",
body: """
The build ${env.JOB_NAME} completed successfully and is back to normal.
Build: ${env.BUILD_URL}
Logs: ${env.BUILD_URL}console
Changes: ${env.BUILD_URL}changes
--
"""
)
}
}
always {
cleanWs()
}