Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QA] slack notify on failure #68126

Merged
merged 23 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .ci/Jenkinsfile_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ kibanaPipeline(timeoutMinutes: 240) {
'CODE_COVERAGE=1', // Enables coverage. Needed for multiple ci scripts, such as remote.ts, test/scripts/*.sh, schema.js, etc.
]) {
workers.base(name: 'coverage-worker', size: 'l', ramDisk: false, bootstrapped: false) {
kibanaCoverage.runTests()
handleIngestion(TIME_STAMP)
catchError {
kibanaCoverage.runTests()
handleIngestion(TIME_STAMP)
}
handleFail()
}
}
kibanaPipeline.sendMail()
Expand All @@ -29,4 +32,10 @@ def handleIngestion(timestamp) {
kibanaCoverage.uploadCoverageStaticSite(timestamp)
}

def handleFail() {
def buildStatus = buildUtils.getBuildStatus()
if(params.NOTIFY_ON_FAILURE && buildStatus != 'SUCCESS' && buildStatus != 'ABORTED') {
kibanaCoverage.onFailure()
wayneseymour marked this conversation as resolved.
Show resolved Hide resolved
}
}

41 changes: 41 additions & 0 deletions vars/kibanaCoverage.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
def onFailure(Map options = [:]) {
catchError {
def status = buildUtils.getBuildStatus()
if (status != "SUCCESS") {
catchErrors {
sendSlackMsg(options)
}
}
}
}

def sendSlackMsg(Map params = [:]) {
def config = [
channel: '#kibana-qa',
title: "*<${env.BUILD_URL}|${slackNotifications.getDefaultDisplayName()}>*",
message: slackNotifications.getDefaultDisplayName(),
color: 'danger',
icon: ':jenkins:',
username: 'Kibana QA',
context: slackNotifications.getDefaultContext(),
] + params


def title = "${slackNotifications.getStatusIcon()} ${config.title}"

def blocks = [slackNotifications.markdownBlock(title)]
slackNotifications.getFailedBuildBlocks().each { blocks << it }
blocks << slackNotifications.dividerBlock()
blocks << config.context

slackSend(
channel: config.channel,
username: config.username,
iconEmoji: config.icon,
color: config.color,
message: config.message,
blocks: blocks
)
}


def uploadCoverageStaticSite(timestamp) {
def uploadPrefix = "gs://elastic-bekitzur-kibana-coverage-live/"
def uploadPrefixWithTimeStamp = "${uploadPrefix}${timestamp}/"
Expand Down