Module: Barbeque::SlackNotifier
- Defined in:
- lib/barbeque/slack_notifier.rb
Class Method Summary collapse
Class Method Details
.notify_job_execution(job_execution) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/barbeque/slack_notifier.rb', line 7 def notify_job_execution(job_execution) return if job_execution.slack_notification.nil? client = Barbeque::SlackClient.new(job_execution.slack_notification.channel) if job_execution.success? if job_execution.slack_notification.notify_success client.notify_success("*[SUCCESS]* Succeeded to execute #{job_execution_link(job_execution)}") end elsif job_execution.failed? if should_notify_failure?(job_execution) client.notify_failure( "*[FAILURE]* Failed to execute #{job_execution_link(job_execution)}" \ " #{job_execution.slack_notification.failure_notification_text}" ) end else client.notify_failure( "*[ERROR]* Failed to execute #{job_execution_link(job_execution)}" \ " #{job_execution.slack_notification.failure_notification_text}" ) end end |
.notify_job_retry(job_retry) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/barbeque/slack_notifier.rb', line 31 def notify_job_retry(job_retry) return if job_retry.slack_notification.nil? client = Barbeque::SlackClient.new(job_retry.slack_notification.channel) if job_retry.success? if job_retry.slack_notification.notify_success client.notify_success("*[SUCCESS]* Succeeded to retry #{job_retry_link(job_retry)}") end elsif job_retry.failed? if should_notify_failure?(job_retry.job_execution) client.notify_failure( "*[FAILURE]* Failed to retry #{job_retry_link(job_retry)}" \ " #{job_retry.slack_notification.failure_notification_text}" ) end else client.notify_failure( "*[ERROR]* Failed to retry #{job_retry_link(job_retry)}" \ " #{job_retry.slack_notification.failure_notification_text}" ) end end |