vidar 0.12.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/vidar/cli.rb +14 -5
- data/lib/vidar/config.rb +8 -7
- data/lib/vidar/deploy_config.rb +5 -1
- data/lib/vidar/slack_notification.rb +6 -1
- data/lib/vidar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8556383ed53d9322bd17288780b6bab8f53b03695c565f1527f3bc5d5322f2fa
|
4
|
+
data.tar.gz: 43090b370b977b36b2b0b40eb3218d51d092ac7ad26348f09855734d2c759052
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d602b3ac6a099e9a51ca81ff285caa5d3067ce1bc2b41314ff6c84d824400695671fd1ba606c7aa16b56dde7e3d66843642d2a239638a3424bc3c1eabd9f073a
|
7
|
+
data.tar.gz: 88bba8dc5eae66dcfbd429802ef71dfab9b775d923e902f184a4642379120eaec6bc8c47cc9e8f9bc50af24895fbaee960371a2547618775c2c311befbc0b93a
|
data/Gemfile.lock
CHANGED
data/lib/vidar/cli.rb
CHANGED
@@ -113,15 +113,11 @@ module Vidar
|
|
113
113
|
Log.info "Current kubectl context: #{Config.get!(:kubectl_context)}"
|
114
114
|
Log.info "Checking if all containers in #{Config.get!(:namespace)} namespace(s) are ready..."
|
115
115
|
|
116
|
-
deploy_config = Config.deploy_config
|
117
|
-
|
118
|
-
Log.error "ERROR: could not find deployment config for #{Config.get!(:kubectl_context)} context" unless deploy_config
|
119
|
-
|
120
116
|
slack_notification = SlackNotification.new(
|
121
117
|
github: Config.get!(:github),
|
122
118
|
revision: Config.get!(:revision),
|
123
119
|
revision_name: Config.get!(:revision_name),
|
124
|
-
deploy_config: deploy_config
|
120
|
+
deploy_config: Config.deploy_config
|
125
121
|
)
|
126
122
|
|
127
123
|
deploy_status = Vidar::DeployStatus.new(namespace: Config.get!(:namespace))
|
@@ -190,5 +186,18 @@ module Vidar
|
|
190
186
|
|
191
187
|
sentry_notification.call if sentry_notification.configured?
|
192
188
|
end
|
189
|
+
|
190
|
+
method_option :message, required: true
|
191
|
+
desc "notify_slack", "Send custom slack notification"
|
192
|
+
def notify_slack
|
193
|
+
slack_notification = SlackNotification.new(
|
194
|
+
github: Config.get!(:github),
|
195
|
+
revision: Config.get!(:revision),
|
196
|
+
revision_name: Config.get!(:revision_name),
|
197
|
+
deploy_config: Config.deploy_config
|
198
|
+
)
|
199
|
+
|
200
|
+
slack_notification.deliver(message: options[:message]) if slack_notification.configured?
|
201
|
+
end
|
193
202
|
end
|
194
203
|
end
|
data/lib/vidar/config.rb
CHANGED
@@ -47,13 +47,14 @@ module Vidar
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def deploy_config
|
50
|
-
deployments = get(:deployments)
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
deployment
|
55
|
-
|
56
|
-
|
50
|
+
deployments = get(:deployments)
|
51
|
+
deployments = {} unless deployments.is_a?(Hash)
|
52
|
+
deployment = deployments[get!(:kubectl_context)]
|
53
|
+
|
54
|
+
if deployment.nil?
|
55
|
+
Log.error "ERROR: could not find deployment config for #{get!(:kubectl_context)} context"
|
56
|
+
return nil
|
57
|
+
end
|
57
58
|
|
58
59
|
deployment.transform_keys!(&:to_sym)
|
59
60
|
deployment.transform_values! { |value| Vidar::Interpolation.call(value, self) }
|
data/lib/vidar/deploy_config.rb
CHANGED
@@ -2,13 +2,17 @@ module Vidar
|
|
2
2
|
class DeployConfig
|
3
3
|
SUCCESS_COLOR = "008800".freeze
|
4
4
|
FAILURE_COLOR = "ff1100".freeze
|
5
|
+
DEFAULT_COLOR = "000000".freeze
|
5
6
|
|
6
|
-
attr_reader :name, :url,
|
7
|
+
attr_reader :name, :url,
|
8
|
+
:default_color, :success_color, :failure_color,
|
9
|
+
:slack_webhook_url, :sentry_webhook_url
|
7
10
|
|
8
11
|
def initialize(options)
|
9
12
|
@name = options.fetch(:name)
|
10
13
|
@url = options.fetch(:url)
|
11
14
|
|
15
|
+
@default_color = options.fetch(:default_color, DEFAULT_COLOR)
|
12
16
|
@success_color = options.fetch(:success_color, SUCCESS_COLOR)
|
13
17
|
@failure_color = options.fetch(:failure_color, FAILURE_COLOR)
|
14
18
|
|
@@ -6,6 +6,7 @@ module Vidar
|
|
6
6
|
@revision_name = revision_name
|
7
7
|
@deploy_name = deploy_config.name
|
8
8
|
@deploy_url = deploy_config.url
|
9
|
+
@default_color = deploy_config.default_color
|
9
10
|
@success_color = deploy_config.success_color
|
10
11
|
@failure_color = deploy_config.failure_color
|
11
12
|
@webhook_url = deploy_config.slack_webhook_url
|
@@ -26,6 +27,10 @@ module Vidar
|
|
26
27
|
perform_with data(message: message, color: success_color)
|
27
28
|
end
|
28
29
|
|
30
|
+
def deliver(message:, color: default_color)
|
31
|
+
perform_with data(message: message, color: color)
|
32
|
+
end
|
33
|
+
|
29
34
|
def perform_with(data)
|
30
35
|
connection.post do |req|
|
31
36
|
req.url webhook_url
|
@@ -38,7 +43,7 @@ module Vidar
|
|
38
43
|
|
39
44
|
attr_reader :github, :revision, :revision_name,
|
40
45
|
:deploy_name, :deploy_url, :webhook_url,
|
41
|
-
:success_color, :failure_color,
|
46
|
+
:default_color, :success_color, :failure_color,
|
42
47
|
:connection
|
43
48
|
|
44
49
|
def data(message:, color:)
|
data/lib/vidar/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Knapik
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-12-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|