barbeque 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/barbeque/job_definitions_controller.rb +1 -1
- data/app/views/barbeque/job_definitions/_slack_notification_field.html.haml +3 -0
- data/db/migrate/20190311034445_add_notify_failure_only_if_retry_limit_reached_to_barbeque_slack_notifications.rb +5 -0
- data/db/migrate/20190315052951_change_barbeque_retry_configs_base_delay_default_value.rb +9 -0
- data/lib/barbeque/slack_notifier.rb +24 -8
- data/lib/barbeque/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 949153219659c19f98869b298ea0b4ec9e549755e43eb2619832ec79aeeeb9c0
|
4
|
+
data.tar.gz: c2fd7f5004b1ff880f416ad7a8b0a0ca632777c0c126276fd14b39db3a7f64f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
@@ -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
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
39
|
-
|
40
|
-
|
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
|
data/lib/barbeque/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|