From 640ff4ed109ee9989bf49bd012dcbb28438cf582 Mon Sep 17 00:00:00 2001 From: Michael Youngstrom Date: Thu, 18 Apr 2019 10:44:45 -0400 Subject: [PATCH] Fix slack messaging in pipelines --- scripts/Jenkinsfiles/bokchoy | 6 ++++-- scripts/Jenkinsfiles/python | 6 ++++-- scripts/Jenkinsfiles/quality | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/Jenkinsfiles/bokchoy b/scripts/Jenkinsfiles/bokchoy index b8a235b260..052cb44ad7 100644 --- a/scripts/Jenkinsfiles/bokchoy +++ b/scripts/Jenkinsfiles/bokchoy @@ -111,7 +111,8 @@ pipeline { propagate: false, wait: false if (currentBuild.currentResult != "SUCCESS"){ - slackSend "`${JOB_NAME}` #${BUILD_NUMBER}: ${currentBuild.currentResult} after ${currentBuild.durationString.replace(' and counting', '')}\n${BUILD_URL}" + slackSend botUser: true, + message: "`${JOB_NAME}` #${BUILD_NUMBER}: ${currentBuild.currentResult} after ${currentBuild.durationString.replace(' and counting', '')}\n${BUILD_URL}" email_body = "See: <${BUILD_URL}>\n\nChanges:\n" change_sets = currentBuild.changeSets @@ -125,7 +126,8 @@ pipeline { emailext body: email_body, subject: "Build failed in Jenkins: ${JOB_NAME} #${BUILD_NUMBER}", to: 'testeng@edx.org' } else if (currentBuild.currentResult == "SUCCESS" && currentBuild.previousBuild.currentResult != "SUCCESS") { - slackSend "`${JOB_NAME}` #${BUILD_NUMBER}: Back to normal after ${currentBuild.durationString.replace(' and counting', '')}\n${BUILD_URL}" + slackSend botUser: true, + message: "`${JOB_NAME}` #${BUILD_NUMBER}: Back to normal after ${currentBuild.durationString.replace(' and counting', '')}\\n${BUILD_URL}" emailext body: "See <${BUILD_URL}>", subject: "Jenkins Build is back to normal: ${JOB_NAME} #${BUILD_NUMBER}", to: 'testeng@edx.org' } diff --git a/scripts/Jenkinsfiles/python b/scripts/Jenkinsfiles/python index 39909bc094..a1a25acb34 100644 --- a/scripts/Jenkinsfiles/python +++ b/scripts/Jenkinsfiles/python @@ -216,7 +216,8 @@ pipeline { propagate: false, wait: false if (currentBuild.currentResult != "SUCCESS"){ - slackSend "`${JOB_NAME}` #${BUILD_NUMBER}: ${currentBuild.currentResult} after ${currentBuild.durationString.replace(' and counting', '')}\n${BUILD_URL}" + slackSend botUser: true, + message: "`${JOB_NAME}` #${BUILD_NUMBER}: ${currentBuild.currentResult} after ${currentBuild.durationString.replace(' and counting', '')}\n${BUILD_URL}" email_body = "See: <${BUILD_URL}>\n\nChanges:\n" change_sets = currentBuild.changeSets @@ -230,7 +231,8 @@ pipeline { emailext body: email_body, subject: "Build failed in Jenkins: ${JOB_NAME} #${BUILD_NUMBER}", to: 'testeng@edx.org' } else if (currentBuild.currentResult == "SUCCESS" && currentBuild.previousBuild.currentResult != "SUCCESS") { - slackSend "`${JOB_NAME}` #${BUILD_NUMBER}: Back to normal after ${currentBuild.durationString.replace(' and counting', '')}\n${BUILD_URL}" + slackSend botUser: true, + message: "`${JOB_NAME}` #${BUILD_NUMBER}: Back to normal after ${currentBuild.durationString.replace(' and counting', '')}\n${BUILD_URL}" emailext body: "See <${BUILD_URL}>", subject: "Jenkins Build is back to normal: ${JOB_NAME} #${BUILD_NUMBER}", to: 'testeng@edx.org' } diff --git a/scripts/Jenkinsfiles/quality b/scripts/Jenkinsfiles/quality index 75a68e5054..58678d277d 100644 --- a/scripts/Jenkinsfiles/quality +++ b/scripts/Jenkinsfiles/quality @@ -231,7 +231,8 @@ pipeline { propagate: false, wait: false if (currentBuild.currentResult != "SUCCESS"){ - slackSend "`${JOB_NAME}` #${BUILD_NUMBER}: ${currentBuild.currentResult} after ${currentBuild.durationString.replace(' and counting', '')}\n${BUILD_URL}" + slackSend botUser: true, + message: "`${JOB_NAME}` #${BUILD_NUMBER}: ${currentBuild.currentResult} after ${currentBuild.durationString.replace(' and counting', '')}\n${BUILD_URL}" email_body = "See: <${BUILD_URL}>\n\nChanges:\n" change_sets = currentBuild.changeSets @@ -245,7 +246,8 @@ pipeline { emailext body: email_body, subject: "Build failed in Jenkins: ${JOB_NAME} #${BUILD_NUMBER}", to: 'testeng@edx.org' } else if (currentBuild.currentResult == "SUCCESS" && currentBuild.previousBuild.currentResult != "SUCCESS") { - slackSend "`${JOB_NAME}` #${BUILD_NUMBER}: Back to normal after ${currentBuild.durationString.replace(' and counting', '')}\n${BUILD_URL}" + slackSend botUser: true, + message: "`${JOB_NAME}` #${BUILD_NUMBER}: Back to normal after ${currentBuild.durationString.replace(' and counting', '')}\n${BUILD_URL}" emailext body: "See <${BUILD_URL}>", subject: "Jenkins Build is back to normal: ${JOB_NAME} #${BUILD_NUMBER}", to: 'testeng@edx.org' }