From a19cbd63eef87fcb45eb2a68f7b19a046519a3a8 Mon Sep 17 00:00:00 2001 From: Gordon Franke Date: Thu, 5 Nov 2020 14:16:00 +0100 Subject: [PATCH] change slack color to reflect all states (#2320) I have used the colors from blue ocean. Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> --- resources/default_pipeline_environment.yml | 2 +- test/groovy/SlackSendNotificationTest.groovy | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/default_pipeline_environment.yml b/resources/default_pipeline_environment.yml index 161d85fd1..4d0d2bfb6 100644 --- a/resources/default_pipeline_environment.yml +++ b/resources/default_pipeline_environment.yml @@ -493,7 +493,7 @@ steps: dockerName: 'bundler' dockerWorkspace: '' slackSendNotification: - color: "${buildStatus == 'SUCCESS'?'#008000':'#E60000'}" + color: "${['SUCCESS': '#8cc04f', 'FAILURE': '#d54c53', 'ABORTED': '#949393', 'UNSTABLE': '#f6b44b', 'PAUSED': '#24b0d5', 'UNKNOWN': '#d54cc4'].get(buildStatus, '#d54cc4')}" defaultMessage: "${buildStatus}: Job ${env.JOB_NAME} <${env.BUILD_URL}|#${env.BUILD_NUMBER}>" snykExecute: buildDescriptorFile: './package.json' diff --git a/test/groovy/SlackSendNotificationTest.groovy b/test/groovy/SlackSendNotificationTest.groovy index c4c9e1298..c4c68737b 100644 --- a/test/groovy/SlackSendNotificationTest.groovy +++ b/test/groovy/SlackSendNotificationTest.groovy @@ -42,7 +42,7 @@ class SlackSendNotificationTest extends BasePiperTest { // asserts assertEquals('Message not set correctly', 'SUCCESS: Job p ', slackCallMap.message.toString()) assertNull('Channel not set correctly', slackCallMap.channel) - assertEquals('Color not set correctly', '#008000', slackCallMap.color) + assertEquals('Color not set correctly', '#8cc04f', slackCallMap.color) assertJobStatusSuccess() } @@ -59,7 +59,7 @@ class SlackSendNotificationTest extends BasePiperTest { stepRule.step.slackSendNotification(script: [currentBuild: [result: 'FAILURE']]) // asserts assertEquals('Message not set correctly', 'FAILURE: Job p ', slackCallMap.message.toString()) - assertEquals('Color not set correctly', '#E60000', slackCallMap.color) + assertEquals('Color not set correctly', '#d54c53', slackCallMap.color) } @Test