Added build notifications to Jenkinsfile

This commit is contained in:
Ashish D'Souza 2023-11-19 17:43:22 -06:00
parent e2812494a0
commit 70a5c983ea
1 changed files with 8 additions and 0 deletions

8
Jenkinsfile vendored
View File

@ -22,6 +22,14 @@ pipeline {
} }
post { post {
failure {
httpRequest contentType: 'APPLICATION_JSON', httpMode: 'POST', ignoreSslErrors: true, requestBody: "{\"topic\": \"jenkins\", \"title\": \"Jenkins\", \"priority\": 4, \"icon\": \"https://jenkins.homelab.net/favicon.ico\", \"click\": \"${BUILD_URL}\", \"message\": \"Build failed for ${JOB_NAME.split('/')[-2]} on ${BRANCH_NAME} branch\"}", responseHandle: 'NONE', url: 'https://ntfy.homelab.net', wrapAsMultipart: false
}
fixed {
httpRequest contentType: 'APPLICATION_JSON', httpMode: 'POST', ignoreSslErrors: true, requestBody: "{\"topic\": \"jenkins\", \"title\": \"Jenkins\", \"priority\": 3, \"icon\": \"https://jenkins.homelab.net/favicon.ico\", \"click\": \"${BUILD_URL}\", \"message\": \"Pipeline fixed for ${JOB_NAME.split('/')[-2]} on ${BRANCH_NAME} branch\"}", responseHandle: 'NONE', url: 'https://ntfy.homelab.net', wrapAsMultipart: false
}
cleanup { cleanup {
cleanWs() cleanWs()
} }