From 35979e7890be7a967dcca362e130521f60cc1d54 Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Wed, 27 May 2020 12:49:39 -0400 Subject: [PATCH] [CI] Change slack notifications icon to yellow heart for unstable (#66896) # Conflicts: # .ci/es-snapshots/Jenkinsfile_verify_es --- .ci/es-snapshots/Jenkinsfile_verify_es | 4 ++-- vars/slackNotifications.groovy | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.ci/es-snapshots/Jenkinsfile_verify_es b/.ci/es-snapshots/Jenkinsfile_verify_es index 9d0359b8f48488..0b908d6cdc8797 100644 --- a/.ci/es-snapshots/Jenkinsfile_verify_es +++ b/.ci/es-snapshots/Jenkinsfile_verify_es @@ -24,8 +24,8 @@ timeout(time: 150, unit: 'MINUTES') { ansiColor('xterm') { catchError { slackNotifications.onFailure( - title: ":broken_heart: *<${env.BUILD_URL}|[${SNAPSHOT_VERSION}] ES Snapshot Verification Failure>*", - message: ":broken_heart: [${SNAPSHOT_VERSION}] ES Snapshot Verification Failure", + title: "*<${env.BUILD_URL}|[${SNAPSHOT_VERSION}] ES Snapshot Verification Failure>*", + message: "[${SNAPSHOT_VERSION}] ES Snapshot Verification Failure", ) { retryable.enable(2) withEnv(["ES_SNAPSHOT_MANIFEST=${SNAPSHOT_MANIFEST}"]) { diff --git a/vars/slackNotifications.groovy b/vars/slackNotifications.groovy index 0eea6640d0831d..c50a99d3e335c5 100644 --- a/vars/slackNotifications.groovy +++ b/vars/slackNotifications.groovy @@ -79,18 +79,29 @@ def getDefaultContext() { ].join(' ยท ')) } +def getStatusIcon() { + def status = buildUtils.getBuildStatus() + if (status == 'UNSTABLE') { + return ':yellow_heart:' + } + + return ':broken_heart:' +} + def sendFailedBuild(Map params = [:]) { def config = [ channel: '#kibana-operations-alerts', - title: ":broken_heart: *<${env.BUILD_URL}|${getDefaultDisplayName()}>*", - message: ":broken_heart: ${getDefaultDisplayName()}", + title: "*<${env.BUILD_URL}|${getDefaultDisplayName()}>*", + message: getDefaultDisplayName(), color: 'danger', icon: ':jenkins:', username: 'Kibana Operations', context: getDefaultContext(), ] + params - def blocks = [markdownBlock(config.title)] + def title = "${getStatusIcon()} ${config.title}" + + def blocks = [markdownBlock(title)] getFailedBuildBlocks().each { blocks << it } blocks << dividerBlock() blocks << config.context