slack-plugin: Failed build notifications not firing after shell script failure
We have a shell script that runs our regression tests. If the tests fail, the shell script exits with exit -1. When this happens the failed build alert does not trigger.
Here is a log sample (tried to sanitize as legibly as possible):
Started by user ****** (<https://****.com/job/****/1157/|Open>) danger
Sep 23, 2015 9:22:34 PM INFO jenkins.plugins.slack.StandardSlackService publish
Posting succeeded
Sep 23, 2015 9:22:34 PM INFO jenkins.plugins.slack.ActiveNotifier getChanges
Empty change...
Sep 23, 2015 9:22:34 PM INFO jenkins.plugins.slack.StandardSlackService publish
Posting: to #***** on ***** using https://*****.slack.com/services/hooks/jenkins-ci?token=***********: ******** - #1157 Starting... after 6.8 sec and counting (<https://******/job/*****/1157/|Open>) danger
Sep 23, 2015 9:22:34 PM INFO jenkins.plugins.slack.StandardSlackService publish
Posting succeeded
Only the starting messages went out, but not the failed messages.
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 23 (5 by maintainers)
after reading https://github.com/jenkinsci/slack-plugin/blob/9c57909027c04261417d984dd87e8184012062ac/src/main/java/jenkins/plugins/slack/ActiveNotifier.java#L116, I just know that Jenkins only notify for the first failure, and there is
NotifyRepeatedFailureoption in the advanced option to keep Jenkins notify repeated failure. https://github.com/jenkinsci/slack-plugin/blob/9c57909027c04261417d984dd87e8184012062ac/src/main/resources/jenkins/plugins/slack/SlackNotifier/config.jelly#L37 sorry I missed that one.What I’m doing here… can you rephrase the checkboxes? Take out the “Notify Repeated Failure” from Hidden “Advanced” stuff, put them next to each other Rename “Notify Failure” to “Notify Failure after success only” Rename “Notify Repeated Failure” to “Notify every failure”
Thank you!
Found the culprit and it looks like it’s intentional. In this file, if I comment out line 100
&& previousResult != Result.FAILUREand rebuild the plugin, I get Slack notifications for Failed builds that had a prior failure. This is the logic that was in HipChat and that I’d expect.