[CI] Change slack notifications icon to yellow heart for unstable (#66896) (#67522)

This commit is contained in:
Brian Seeders 2020-05-27 14:57:48 -04:00 committed by GitHub
parent cc52f497ea
commit 3b52b5c7c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View file

@ -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}"]) {

View file

@ -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