Skip to content

Commit f95ed33

Browse files
committed
Fix Slack notification error handling and remove some debug code
1 parent 06b45d0 commit f95ed33

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

Jenkinsfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ kibanaPipeline(timeoutMinutes: 135, checkPrChanges: true) {
88
githubPr.withDefaultPrComments {
99
catchError {
1010
retryable.enable()
11-
catchError {
12-
slackNotifications.onFailure {
13-
error "Test Error"
14-
}
15-
}
1611
slackNotifications.onFailure {
1712
parallel([
1813
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),

vars/slackNotifications.groovy

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,15 @@ def getTestFailures() {
100100
}
101101

102102
def onFailure(Map options = [:], Closure closure) {
103-
try {
103+
// try/finally will NOT work here, because the build status will not have been changed to ERROR when the finally{} block executes
104+
catchError {
104105
closure()
105-
} finally {
106-
def status = buildUtils.getBuildStatus()
107-
if (status != "SUCCESS" && status != "UNSTABLE") {
108-
catchErrors {
109-
sendFailedBuild(options)
110-
}
106+
}
107+
108+
def status = buildUtils.getBuildStatus()
109+
if (status != "SUCCESS" && status != "UNSTABLE") {
110+
catchErrors {
111+
sendFailedBuild(options)
111112
}
112113
}
113114
}

0 commit comments

Comments
 (0)