From 114b62f10951310640074c24787db9e835fb65f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Wed, 27 Sep 2017 16:30:15 +0200 Subject: [PATCH 1/2] Actually show PR branch name in Slack failure notification --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index fa8274db5..2d97f5e11 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ def fail(reason) { def pr_branch = '' if (env.CHANGE_BRANCH != null) { - pr_branch = " ($BRANCH_NAME)" + pr_branch = " (${env.CHANGE_BRANCH})" } slackSend color: 'danger', message: "Build #${env.BUILD_NUMBER} of <${env.BUILD_URL}|${env.JOB_NAME}>${pr_branch} failed (<${env.BUILD_URL}/console|console>, <${env.BUILD_URL}/changes|changes>)\nCause: ${reason}", channel: '#lisk-nano-jenkins' currentBuild.result = 'FAILURE' From cb840beaa920c7f0310fdd0aef96545a753ca980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Wed, 27 Sep 2017 17:15:56 +0200 Subject: [PATCH 2/2] Send Slack sucess notification when job recovers --- Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 2d97f5e11..73c104ba8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -147,6 +147,10 @@ node('lisk-nano-01'){ fail('Stopping build, Deploy failed') } milestone 1 + /* notify of success if previous build failed */ + if (currentBuild.getPreviousBuild().result == 'FAILURE') { + slackSend color: 'good', message: "Recovery: build #${env.BUILD_NUMBER} of <${env.BUILD_URL}|${env.JOB_NAME}> was sucessful.", channel: '#lisk-nano-jenkins' + } } } }