kapost_deploy 0.5.0 → 0.6.1

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
  SHA1:
3
- metadata.gz: 35496ee79724b9cfbe70cffbfd632cb6b0dd7ac3
4
- data.tar.gz: 04c2f11eedb818589fdbb983762d63678f7fc8c8
3
+ metadata.gz: 04addf50a291a82340d0a7f8c2110c5a331c293a
4
+ data.tar.gz: ba680280d1c91e799b25802b86032a54b7fd1482
5
5
  SHA512:
6
- metadata.gz: 666c8a661c70b34e34c44dccaab8d85b5ec42df2d9b70ddcbc50fc17b7539eaebdf0991c6da96814d74c9d7024239e361c7eb356ad4901885fb41bcd8bc87ef4
7
- data.tar.gz: 45e1be36164b08069c928a05caa437de9fff7fabda51580ae69119dcf58e31acbd79c6e6646843e4d4a8178698e40d55573427cfb80952b4cd3c1f46b716a04e
6
+ metadata.gz: 52f2f8ba529c5376a8d5298daacd7e8a471b19ddaa8b91eff63dbc7a955cfefa700302de6ca5e10231cc2fc5e40c6bc5184ab071837309f8c70eb572303aa959
7
+ data.tar.gz: e60b0a71344eae895bff8f42b973675db2ebf67d5ff2e6fa28ba6aa86de33b070805d3e1adab42b522622871c2bb91f0362a70128b39ea7e6c66260da43e8597
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <!-- Tocer[start]: Auto-generated, don't remove. -->
8
8
 
9
- # Table of Contents
9
+ ## Table of Contents
10
10
 
11
11
  - [Features](#features)
12
12
  - [Requirements](#requirements)
@@ -12,7 +12,7 @@ module KapostDeploy
12
12
  end
13
13
 
14
14
  def self.version
15
- "0.5.0"
15
+ "0.6.1"
16
16
  end
17
17
 
18
18
  def self.version_label
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "kapost_deploy/heroku/app_releases"
4
+
5
+ module KapostDeploy
6
+ module Plugins
7
+ # Notify Datadog (via seismograph) about deployments by:
8
+ # - sending deployment timing
9
+ # - logging an info event
10
+ class NotifyDatadogAfterPromote
11
+ def initialize(config,
12
+ notifier: KapostDeploy::Seismograph::Notifier.new,
13
+ ahead_releases: KapostDeploy::Heroku::AppReleases.new(config.app, token: config.heroku_api_token))
14
+ self.config = config
15
+ self.notifier = notifier
16
+ self.ahead_releases = ahead_releases
17
+ end
18
+
19
+ def before
20
+ @start_time = Time.now
21
+ end
22
+
23
+ def after
24
+ return unless start_time
25
+
26
+ notify_datadog
27
+ end
28
+
29
+ private
30
+
31
+ attr_accessor :config,
32
+ :notifier,
33
+ :ahead_releases,
34
+ :start_time
35
+
36
+ def notify_datadog
37
+ time_elapsed = Time.now - start_time
38
+
39
+ notifier.timing "deploy", time_elapsed, tags
40
+ notifier.info "Deployed #{github_repo} to #{env}"
41
+ end
42
+
43
+ def tags
44
+ [
45
+ "env:#{env}",
46
+ "sha:#{commit_sha}",
47
+ "repository:#{github_repo}"
48
+ ]
49
+ end
50
+
51
+ def env
52
+ config.to.split("-").last
53
+ end
54
+
55
+ def commit_sha
56
+ ci_sha || pipeline_sha
57
+ end
58
+
59
+ def ci_sha
60
+ ENV["CIRCLE_SHA1"]
61
+ end
62
+
63
+ def pipeline_sha
64
+ ahead_releases.latest_deploy_version
65
+ end
66
+
67
+ def github_repo
68
+ config.options.fetch(:git_config).fetch(:github_repo)
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KapostDeploy
4
+ module Seismograph
5
+ def self.seismograph_adapter
6
+ require "seismograph"
7
+ ::Seismograph
8
+ rescue LoadError
9
+ NullAdapter
10
+ end
11
+
12
+ # Wrapper for seismograph gem
13
+ class Notifier
14
+ extend Forwardable
15
+
16
+ def_delegator :sensor, :timing
17
+ def_delegator :logger, :info
18
+
19
+ def initialize
20
+ self.adapter = KapostDeploy::Seismograph.seismograph_adapter
21
+ end
22
+
23
+ private
24
+
25
+ attr_accessor :adapter
26
+
27
+ def sensor
28
+ @sensor ||= adapter::Sensor.new(:kapost_deploy)
29
+ end
30
+
31
+ def logger
32
+ adapter::Log
33
+ end
34
+ end
35
+
36
+ module NullAdapter
37
+ class Sensor
38
+ def initialize(_namespace); end
39
+
40
+ def timing(_description, _duration, _params = {}); end
41
+ end
42
+
43
+ module Log
44
+ def self.info(_message, _params = {}); end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -102,6 +102,7 @@ module KapostDeploy
102
102
  end
103
103
 
104
104
  def promoter
105
+ fail "`HEROKU_DEPLOY_API_TOKEN` env var must be provided" unless heroku_api_token
105
106
  @promoter ||= KapostDeploy::Heroku::AppPromoter.new(pipeline, token: heroku_api_token)
106
107
  end
107
108
 
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kapost_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Croft
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-03 00:00:00.000000000 Z
11
+ date: 2018-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: honeybadger
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '10.0'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '10.0'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: platform-api
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,33 +39,33 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.6.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: slack-notify
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.4.1
47
+ version: '10.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.4.1
54
+ version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: honeybadger
56
+ name: slack-notify
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '2.0'
61
+ version: 0.4.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '2.0'
68
+ version: 0.4.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -81,21 +81,21 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.11'
83
83
  - !ruby/object:Gem::Dependency
84
- name: gemsmith
84
+ name: climate_control
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '7.7'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '7.7'
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: pry
98
+ name: codeclimate-test-reporter
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,21 +109,21 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: pry-byebug
112
+ name: gemsmith
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: '10.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: '10.0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: pry-state
126
+ name: guard-rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -137,21 +137,21 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: rspec
140
+ name: pry
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: '3.4'
145
+ version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: '3.4'
152
+ version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: rb-fsevent
154
+ name: pry-byebug
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
@@ -165,7 +165,7 @@ dependencies:
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
- name: guard-rspec
168
+ name: pry-state
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - ">="
@@ -179,7 +179,7 @@ dependencies:
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
- name: terminal-notifier
182
+ name: rb-fsevent
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - ">="
@@ -193,35 +193,35 @@ dependencies:
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  - !ruby/object:Gem::Dependency
196
- name: terminal-notifier-guard
196
+ name: rspec
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - ">="
199
+ - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '0'
201
+ version: '3.4'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - ">="
206
+ - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '0'
208
+ version: '3.4'
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: rubocop
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: '0.40'
215
+ version: '0.52'
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: '0.40'
222
+ version: '0.52'
223
223
  - !ruby/object:Gem::Dependency
224
- name: codeclimate-test-reporter
224
+ name: seismograph
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - ">="
@@ -235,7 +235,21 @@ dependencies:
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
237
  - !ruby/object:Gem::Dependency
238
- name: climate_control
238
+ name: terminal-notifier
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ - !ruby/object:Gem::Dependency
252
+ name: terminal-notifier-guard
239
253
  requirement: !ruby/object:Gem::Requirement
240
254
  requirements:
241
255
  - - ">="
@@ -263,10 +277,12 @@ files:
263
277
  - lib/kapost_deploy/heroku/shell.rb
264
278
  - lib/kapost_deploy/identity.rb
265
279
  - lib/kapost_deploy/plugins/db_migrate.rb
280
+ - lib/kapost_deploy/plugins/notify_datadog_after_promote.rb
266
281
  - lib/kapost_deploy/plugins/notify_honeybadger_after_promote.rb
267
282
  - lib/kapost_deploy/plugins/slack_after_promote.rb
268
283
  - lib/kapost_deploy/plugins/slack_github_diff.rb
269
284
  - lib/kapost_deploy/plugins/validate_before_promote.rb
285
+ - lib/kapost_deploy/seismograph/notifier.rb
270
286
  - lib/kapost_deploy/slack/notifier.rb
271
287
  - lib/kapost_deploy/task.rb
272
288
  - lib/tasks/console.rake
@@ -292,7 +308,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
292
308
  version: '0'
293
309
  requirements: []
294
310
  rubyforge_project:
295
- rubygems_version: 2.6.6
311
+ rubygems_version: 2.6.13
296
312
  signing_key:
297
313
  specification_version: 4
298
314
  summary: Deployment rake tasks for Kapost applications