From cb4d7694411433cbe000a84afa7a3d368916192a Mon Sep 17 00:00:00 2001 From: osher cohen Date: Thu, 17 Sep 2020 16:57:10 +0300 Subject: [PATCH] Notify on abort --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7d673b9..b72e8d8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,9 +42,9 @@ pipeline { } } post { - failure { + always { script { - if (env.BRANCH_NAME == 'master') + if ((env.BRANCH_NAME == 'master') && (currentBuild.currentResult == "ABORTED" || currentBuild.currentResult == "FAILURE")){ stage('notify master branch fail') { script { def data = [text: "Attention! assisted-ignition-generator branch test failed, see: ${BUILD_URL}"] @@ -52,6 +52,7 @@ pipeline { } sh '''curl -X POST -H 'Content-type: application/json' --data-binary "@data.txt" https://hooks.slack.com/services/${SLACK_TOKEN}''' } + } } } }