From 70a5c983ead03dad90f6ade7d5fdf1d48b308164 Mon Sep 17 00:00:00 2001 From: Ashish D'Souza Date: Sun, 19 Nov 2023 17:43:22 -0600 Subject: [PATCH] Added build notifications to Jenkinsfile --- Jenkinsfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 838965f..0592a00 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,6 +22,14 @@ pipeline { } 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 { cleanWs() }