Skip to content

Commit

Permalink
[CI] Change slack notifications icon to yellow heart for unstable (el…
Browse files Browse the repository at this point in the history
…astic#66896)

# Conflicts:
#	.ci/es-snapshots/Jenkinsfile_verify_es
  • Loading branch information
brianseeders committed May 27, 2020
1 parent fbe078c commit 35979e7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .ci/es-snapshots/Jenkinsfile_verify_es
Original file line number Diff line number Diff line change
Expand Up @@ -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}"]) {
Expand Down
17 changes: 14 additions & 3 deletions vars/slackNotifications.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 35979e7

Please sign in to comment.