vidar 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25154b4636e2c566f0c4a8d321231dce9bc766509f1016d3056316ec7563e6d8
4
- data.tar.gz: 2426f768d011184556376fa04ac8556b012fc92bba4d6c59eaff7650c719ccf4
3
+ metadata.gz: 863f274d6a61cd8994635991676237b25206725a79b365c833777d182cd491fb
4
+ data.tar.gz: aa284f1ce269979dd41a91acde974b17ba511b3364e1ff933fcc7a2fe7cac1f8
5
5
  SHA512:
6
- metadata.gz: 56bcbddbf38a7e5da132be0da2e2bccc992fbc868e6f1f945e3c1d273c3fbf54c9be466481c4d611556929f769d2837189c0d40ac113b78f3d63b3c4af9fad57
7
- data.tar.gz: d78a259aad2f32eb343b66ab4ee930f3fad695548c0305af9fb4332957e6eecaa73d3434b1bfee5df1008d78e38ba1e17b08566aadae21bee79fd7e13cdf5142
6
+ metadata.gz: 66baed08f21e8187e9dd0457730d919eb7adc0be881d8999c4d673e179e15b8ae2807aedadaa66c47cf76c1ad83f2d9df366e25b11c52facf6c560d11d5d09a5
7
+ data.tar.gz: 4e9c6946c3cc739e38e613e4a6fc72fbdfce76a310d31b6f7d8228a03df64d1d6c694b67e43a77bb208e2c14c0ade032deeed15112ff72b7e32081c581cd27f3
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.6.4
1
+ ruby-2.6.5
data/.travis.yml CHANGED
@@ -3,5 +3,8 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.6.4
6
+ - 2.6.5
7
7
  before_install: gem install bundler -v 2.0.2
8
+ script:
9
+ - bundle exec rspec
10
+ - bundle exec rubocop
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vidar (0.5.1)
4
+ vidar (0.6.0)
5
5
  colorize
6
6
  faraday
7
7
  thor (~> 0.20)
@@ -14,12 +14,12 @@ GEM
14
14
  coderay (1.1.2)
15
15
  colorize (0.8.1)
16
16
  diff-lcs (1.3)
17
- faraday (0.16.2)
17
+ faraday (0.17.0)
18
18
  multipart-post (>= 1.2, < 3)
19
19
  jaro_winkler (1.5.3)
20
20
  method_source (0.9.2)
21
21
  multipart-post (2.1.1)
22
- parallel (1.17.0)
22
+ parallel (1.18.0)
23
23
  parser (2.6.5.0)
24
24
  ast (~> 2.4.0)
25
25
  pry (0.12.2)
@@ -27,19 +27,19 @@ GEM
27
27
  method_source (~> 0.9.0)
28
28
  rainbow (3.0.0)
29
29
  rake (13.0.0)
30
- rspec (3.8.0)
31
- rspec-core (~> 3.8.0)
32
- rspec-expectations (~> 3.8.0)
33
- rspec-mocks (~> 3.8.0)
34
- rspec-core (3.8.2)
35
- rspec-support (~> 3.8.0)
36
- rspec-expectations (3.8.5)
30
+ rspec (3.9.0)
31
+ rspec-core (~> 3.9.0)
32
+ rspec-expectations (~> 3.9.0)
33
+ rspec-mocks (~> 3.9.0)
34
+ rspec-core (3.9.0)
35
+ rspec-support (~> 3.9.0)
36
+ rspec-expectations (3.9.0)
37
37
  diff-lcs (>= 1.2.0, < 2.0)
38
- rspec-support (~> 3.8.0)
39
- rspec-mocks (3.8.2)
38
+ rspec-support (~> 3.9.0)
39
+ rspec-mocks (3.9.0)
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.8.0)
42
- rspec-support (3.8.3)
41
+ rspec-support (~> 3.9.0)
42
+ rspec-support (3.9.0)
43
43
  rubocop (0.75.0)
44
44
  jaro_winkler (~> 1.5.1)
45
45
  parallel (~> 1.10)
data/README.md CHANGED
@@ -30,12 +30,12 @@ Or install it yourself as:
30
30
 
31
31
  ```yml
32
32
  # docker image name, required
33
- image: gcr.io/renofiinfrastructure/vidar
33
+ image: gcr.io/renofiinfrastructure/vidar
34
34
  # k8s namespace, required
35
- namespace: borrower
35
+ namespace: borrower
36
36
  # github name used to build deployment notification content
37
- github: RenoFi/vidar
38
- # deployments config per kubectl context, required for `monitor_deploy_status` command
37
+ github: RenoFi/vidar
38
+ # deployments config per kubectl context, required for `monitor_deploy_status` command
39
39
  deployments:
40
40
  gke_project_us-east4_staging:
41
41
  # Deployment Name
@@ -47,6 +47,8 @@ deployments:
47
47
  # Deployment url, e.g. url to gke cluster workloads filtered by namespace
48
48
  # Similar to all other values it may contain references to others using mustache-like interpolation.
49
49
  url: "https://console.cloud.google.com/kubernetes/workload?project=project&namespace={{namespace}}"
50
+ # Sentry webhook url use to send deploy notifications, optional
51
+ sentry_webhook_url: https://sentry.io/api/hooks/release/builtin/123/asdf
50
52
  # Slack webhook url use to send deploy notifications, optional
51
53
  slack_webhook_url: https://hooks.slack.com/services/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
52
54
  # docker-compose file, optional, default value: docker-compose.ci.yml
data/lib/vidar.rb CHANGED
@@ -12,6 +12,7 @@ require 'vidar/config'
12
12
  require 'vidar/interpolation'
13
13
  require 'vidar/log'
14
14
  require 'vidar/run'
15
+ require 'vidar/sentry_notification'
15
16
  require 'vidar/slack_notification'
16
17
  require 'vidar/k8s/container_status'
17
18
  require 'vidar/k8s/pod_set'
data/lib/vidar/cli.rb CHANGED
@@ -80,6 +80,7 @@ module Vidar
80
80
  deploy_status.wait_until_completed
81
81
 
82
82
  unless deploy_status.success?
83
+ Run.kubectl "describe job deploy-hook"
83
84
  Log.error "Error running deploy hook template"
84
85
  exit(1)
85
86
  end
@@ -118,6 +119,11 @@ module Vidar
118
119
  deploy_config: deploy_config
119
120
  )
120
121
 
122
+ sentry_notification = SentryNotification.new(
123
+ revision: Config.get!(:revision),
124
+ deploy_config: deploy_config
125
+ )
126
+
121
127
  deploy_status = Vidar::DeployStatus.new(namespace: Config.get!(:namespace))
122
128
 
123
129
  deploy_status.wait_until_completed
@@ -125,6 +131,7 @@ module Vidar
125
131
  if deploy_status.success?
126
132
  Log.info "OK: All containers are ready"
127
133
  slack_notification.success if slack_notification.configured?
134
+ sentry_notification.call if sentry_notification.configured?
128
135
  else
129
136
  Log.error "ERROR: Some of containers are errored or not ready"
130
137
  slack_notification.failure if slack_notification.configured?
@@ -3,14 +3,17 @@ module Vidar
3
3
  SUCCESS_COLOR = "008800".freeze
4
4
  FAILURE_COLOR = "ff1100".freeze
5
5
 
6
- attr_reader :name, :url, :success_color, :failure_color, :slack_webhook_url
6
+ attr_reader :name, :url, :success_color, :failure_color, :slack_webhook_url, :sentry_webhook_url
7
7
 
8
- def initialize(name:, url:, slack_webhook_url:, success_color: SUCCESS_COLOR, failure_color: FAILURE_COLOR)
9
- @name = name
10
- @url = url
11
- @success_color = success_color
12
- @failure_color = failure_color
13
- @slack_webhook_url = slack_webhook_url
8
+ def initialize(options)
9
+ @name = options.fetch(:name)
10
+ @url = options.fetch(:url)
11
+
12
+ @success_color = options.fetch(:success_color, SUCCESS_COLOR)
13
+ @failure_color = options.fetch(:failure_color, FAILURE_COLOR)
14
+
15
+ @slack_webhook_url = options[:slack_webhook_url]
16
+ @sentry_webhook_url = options[:sentry_webhook_url]
14
17
  end
15
18
  end
16
19
  end
@@ -0,0 +1,31 @@
1
+ module Vidar
2
+ class SentryNotification
3
+ def initialize(revision:, deploy_config:)
4
+ @revision = revision
5
+ @webhook_url = deploy_config.sentry_webhook_url
6
+ @connection = Faraday.new
7
+ end
8
+
9
+ def configured?
10
+ !webhook_url.to_s.empty?
11
+ end
12
+
13
+ def call
14
+ connection.post do |req|
15
+ req.url webhook_url
16
+ req.headers['Content-Type'] = 'application/json'
17
+ req.body = data.to_json
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ attr_reader :connection, :revision, :webhook_url
24
+
25
+ def data
26
+ {
27
+ "version": revision
28
+ }
29
+ end
30
+ end
31
+ end
data/lib/vidar/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vidar
2
- VERSION = '0.5.1'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end
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.5.1
4
+ version: 0.6.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-10-03 00:00:00.000000000 Z
12
+ date: 2019-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -185,6 +185,7 @@ files:
185
185
  - lib/vidar/k8s/pod_set.rb
186
186
  - lib/vidar/log.rb
187
187
  - lib/vidar/run.rb
188
+ - lib/vidar/sentry_notification.rb
188
189
  - lib/vidar/slack_notification.rb
189
190
  - lib/vidar/version.rb
190
191
  - vidar.gemspec