barbeque 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee2d835c84a99b3c12b30c45c6b133bd45dee8c0c90c69792e82ce7e31c4f589
4
- data.tar.gz: a2d3a604433215188449ea6fb22dcf4f5da73ec833874d9af4abcbd2fd697132
3
+ metadata.gz: 949153219659c19f98869b298ea0b4ec9e549755e43eb2619832ec79aeeeb9c0
4
+ data.tar.gz: c2fd7f5004b1ff880f416ad7a8b0a0ca632777c0c126276fd14b39db3a7f64f9
5
5
  SHA512:
6
- metadata.gz: 5ba6a9de43ffda9cc5fe4dd3f5c4dde4428cc624c999831391e85a15815381957569c8b1953c07719a2444c539e1dd1d8e37cbb1bc687aefa536571df41f661e
7
- data.tar.gz: 015b27c099386c2338bee1c9c8ebbc3ad5eea1bce3cb0ab71404808f38ee334b467d011afda2887aa00ed46b1e992cbbfcdae2e55001163ae2570da131f85530
6
+ metadata.gz: bab2ab1ff1bd5f93f26a7bbef69941e365818b110c81344d74db2c55e46bc4e11830a969f7ce0fd0dfce32f746abe6e65fb7ad314f4c8757ac5af8f8bd411004
7
+ data.tar.gz: cf87d8a77788493e25d65378615f30e93ad7475b7389061be0bb32ba2ea643c54d8a1db3959422fc39a6ea02cc71fa688e6c18ea429553912f4410215f786a74
@@ -81,7 +81,7 @@ class Barbeque::JobDefinitionsController < Barbeque::ApplicationController
81
81
  private
82
82
 
83
83
  def slack_notification_params
84
- %i[id channel notify_success failure_notification_text _destroy]
84
+ %i[id channel notify_success notify_failure_only_if_retry_limit_reached failure_notification_text _destroy]
85
85
  end
86
86
 
87
87
  def retry_config_params
@@ -25,6 +25,9 @@
25
25
  .col-md-8
26
26
  = f.check_box :notify_success
27
27
  = f.label :notify_success, 'Notify success event to Slack'
28
+ .col-md-8
29
+ = f.check_box :notify_failure_only_if_retry_limit_reached
30
+ = f.label :notify_failure_only_if_retry_limit_reached, 'Notify failure event to Slack only if retry limit reached'
28
31
 
29
32
  .row
30
33
  .col-md-8
@@ -0,0 +1,5 @@
1
+ class AddNotifyFailureOnlyIfRetryLimitReachedToBarbequeSlackNotifications < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :barbeque_slack_notifications, :notify_failure_only_if_retry_limit_reached, :boolean, default: false, null: false
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class ChangeBarbequeRetryConfigsBaseDelayDefaultValue < ActiveRecord::Migration[5.2]
2
+ def up
3
+ change_column_default :barbeque_retry_configs, :base_delay, 15
4
+ end
5
+
6
+ def down
7
+ change_column_default :barbeque_retry_configs, :base_delay, 0.3
8
+ end
9
+ end
@@ -13,10 +13,12 @@ module Barbeque
13
13
  client.notify_success("*[SUCCESS]* Succeeded to execute #{job_execution_link(job_execution)}")
14
14
  end
15
15
  elsif job_execution.failed?
16
- client.notify_failure(
17
- "*[FAILURE]* Failed to execute #{job_execution_link(job_execution)}" \
18
- " #{job_execution.slack_notification.failure_notification_text}"
19
- )
16
+ if should_notify_failure?(job_execution)
17
+ client.notify_failure(
18
+ "*[FAILURE]* Failed to execute #{job_execution_link(job_execution)}" \
19
+ " #{job_execution.slack_notification.failure_notification_text}"
20
+ )
21
+ end
20
22
  else
21
23
  client.notify_failure(
22
24
  "*[ERROR]* Failed to execute #{job_execution_link(job_execution)}" \
@@ -35,10 +37,12 @@ module Barbeque
35
37
  client.notify_success("*[SUCCESS]* Succeeded to retry #{job_retry_link(job_retry)}")
36
38
  end
37
39
  elsif job_retry.failed?
38
- client.notify_failure(
39
- "*[FAILURE]* Failed to retry #{job_retry_link(job_retry)}" \
40
- " #{job_retry.slack_notification.failure_notification_text}"
41
- )
40
+ if should_notify_failure?(job_retry.job_execution)
41
+ client.notify_failure(
42
+ "*[FAILURE]* Failed to retry #{job_retry_link(job_retry)}" \
43
+ " #{job_retry.slack_notification.failure_notification_text}"
44
+ )
45
+ end
42
46
  else
43
47
  client.notify_failure(
44
48
  "*[ERROR]* Failed to retry #{job_retry_link(job_retry)}" \
@@ -68,6 +72,18 @@ module Barbeque
68
72
  def job_retry_url(job_retry)
69
73
  Barbeque::Engine.routes.url_helpers.job_execution_job_retry_url(job_retry.job_execution, job_retry, host: barbeque_host)
70
74
  end
75
+
76
+ def should_notify_failure?(job_execution_with_slack_notification)
77
+ unless job_execution_with_slack_notification.slack_notification.notify_failure_only_if_retry_limit_reached
78
+ return true
79
+ end
80
+
81
+ unless job_execution_with_slack_notification.job_definition.retry_config
82
+ return true
83
+ end
84
+
85
+ job_execution_with_slack_notification.job_definition.retry_config.retry_limit <= job_execution_with_slack_notification.job_retries.count
86
+ end
71
87
  end
72
88
  end
73
89
  end
@@ -1,3 +1,3 @@
1
1
  module Barbeque
2
- VERSION = '2.6.0'
2
+ VERSION = '2.7.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barbeque
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-25 00:00:00.000000000 Z
11
+ date: 2019-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: adminlte2-rails
@@ -423,6 +423,8 @@ files:
423
423
  - db/migrate/20170724025542_add_index_to_job_execution_status.rb
424
424
  - db/migrate/20180411070937_add_index_to_barbeque_job_executions_created_at.rb
425
425
  - db/migrate/20190221050714_create_barbeque_retry_configs.rb
426
+ - db/migrate/20190311034445_add_notify_failure_only_if_retry_limit_reached_to_barbeque_slack_notifications.rb
427
+ - db/migrate/20190315052951_change_barbeque_retry_configs_base_delay_default_value.rb
426
428
  - lib/barbeque.rb
427
429
  - lib/barbeque/config.rb
428
430
  - lib/barbeque/docker_image.rb
@@ -473,7 +475,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
473
475
  - !ruby/object:Gem::Version
474
476
  version: '0'
475
477
  requirements: []
476
- rubygems_version: 3.0.1
478
+ rubygems_version: 3.0.3
477
479
  signing_key:
478
480
  specification_version: 4
479
481
  summary: Job queue system to run job with Docker