Hipchat build notification when retrying failed
Summary
When "retrying" a failed build, a hipchat build notification is sent immediately that says "Commit XYZ branch by XY failed in N second(s)". When the retried build succeeds or fails, it also sends the appropriate message then.
Steps to reproduce
- Have the Hipchat service enabled with the "Build" checkbox set
- Have a build that has failed
- Click on the "retry" button to retry the failed build
- Be shocked by the notification that your build failed already
Expected behavior
No notification should be sent when a retry is initiated, only on eventual success/failure.
Actual behavior
A "failed build" notification is sent when a retry is initiated.
Possible fixes
I think this patch might fix it:
diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb
index afebd3b..d74879f 100644
--- a/app/models/project_services/hipchat_service.rb
+++ b/app/models/project_services/hipchat_service.rb
@@ -281,6 +281,10 @@ class HipchatService < Service
end
def should_build_be_notified?(data)
+ if !['success','failed'].include?(data[:build_status])
+ return false
+ end
+
case data[:commit][:status]
when 'success'
!notify_only_broken_builds?
Edited by Jason Yavorsky