kitchen_hooks 1.5.8 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/etc/commit.json +7 -7
- data/lib/kitchen_hooks/app.rb +31 -16
- data/lib/kitchen_hooks/helpers.rb +79 -70
- data/lib/kitchen_hooks/main.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9eb74c5dbbe7c83206e30120671a1bf59553258a
|
4
|
+
data.tar.gz: 9a722f4f0cf0ed44da7eaa7cf8668cc871a0ddd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ad297874b1379c5ba0ac75ff27288ee47bc64633969c27103abbdcf74ae6303a8545138b36ff6cd06e3d7ea43c5537c073843b27baf13bd4eb76b7a85255012
|
7
|
+
data.tar.gz: ed60bee3bfaffbf40f2395888a4c77f57537ac1c2bd4fab1da04552f58c6b7b2a9c85fa72f8012d79acdcafb233f079a585b393f6de24b566918d2f8d1a365f2
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.6.0
|
data/etc/commit.json
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
{
|
2
2
|
"before": "08f20548e398f634979047d0c8114260bcc2949a",
|
3
|
-
"after": "
|
4
|
-
"ref": "refs/tags/
|
3
|
+
"after": "0835e7c74314cfe2aa9f98fe47338031b637ef95",
|
4
|
+
"ref": "refs/tags/v0.0.4",
|
5
5
|
"user_id": 645,
|
6
6
|
"user_name": "Sean Clemmer",
|
7
7
|
"repository": {
|
8
|
-
"name": "
|
9
|
-
"url": "git@git.bluejeansnet.com:chef/
|
8
|
+
"name": "realm_catalyst",
|
9
|
+
"url": "git@git.bluejeansnet.com:chef/realm_catalyst.git",
|
10
10
|
"description": "",
|
11
|
-
"homepage": "http://git.bluejeansnet.com/chef/
|
11
|
+
"homepage": "http://git.bluejeansnet.com/chef/realm_catalyst"
|
12
12
|
},
|
13
13
|
"commits": [
|
14
14
|
{
|
15
|
-
"id": "
|
15
|
+
"id": "0835e7c74314cfe2aa9f98fe47338031b637ef95",
|
16
16
|
"message": "XYZ",
|
17
17
|
"timestamp": "2014-11-25T18:30:57-08:00",
|
18
|
-
"url": "http://git.bluejeansnet.com/chef/
|
18
|
+
"url": "http://git.bluejeansnet.com/chef/realm_catalyst/commit/7b238ce9c6cff250db5a0b727b9661b618b82e1d",
|
19
19
|
"author": {
|
20
20
|
"name": "Sean Clemmer",
|
21
21
|
"email": "sclemmer@bluejeans.com"
|
data/lib/kitchen_hooks/app.rb
CHANGED
@@ -16,15 +16,26 @@ module KitchenHooks
|
|
16
16
|
|
17
17
|
enable :sessions
|
18
18
|
|
19
|
-
include KitchenHooks::Helpers
|
20
|
-
|
21
19
|
def self.db! path
|
22
20
|
@@db = Daybreak::DB.new path
|
23
21
|
end
|
24
22
|
|
25
23
|
def self.tmp! dir ; @@tmp = dir end
|
26
24
|
|
27
|
-
def self.close!
|
25
|
+
def self.close!
|
26
|
+
@@backlog_worker.kill
|
27
|
+
@@db.close
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.backlog!
|
31
|
+
@@backlog = Queue.new
|
32
|
+
@@backlog_worker = Thread.new do
|
33
|
+
loop do
|
34
|
+
event = @@backlog.shift
|
35
|
+
App.process event
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
28
39
|
|
29
40
|
def self.config! config
|
30
41
|
@@hipchat = nil
|
@@ -38,11 +49,17 @@ module KitchenHooks
|
|
38
49
|
end
|
39
50
|
end
|
40
51
|
|
52
|
+
get '/backlog' do
|
53
|
+
content_type :json
|
54
|
+
JSON.pretty_generate \
|
55
|
+
backlog: @@backlog.inspect,
|
56
|
+
length: @@backlog.length
|
57
|
+
end
|
41
58
|
|
42
59
|
get '/' do
|
43
|
-
process_release
|
60
|
+
App.process_release
|
44
61
|
db_entries = {}
|
45
|
-
db.each do |k, v|
|
62
|
+
@@db.each do |k, v|
|
46
63
|
db_entries[k] = v unless k =~ /^meta/
|
47
64
|
end
|
48
65
|
erb :app, locals: {
|
@@ -63,28 +80,26 @@ module KitchenHooks
|
|
63
80
|
post '/' do
|
64
81
|
request.body.rewind
|
65
82
|
event = JSON::parse request.body.read rescue nil
|
66
|
-
|
67
|
-
process event
|
68
|
-
end
|
83
|
+
@@backlog.push event
|
69
84
|
end
|
70
85
|
|
71
86
|
|
72
87
|
|
73
88
|
private
|
74
|
-
def
|
89
|
+
def self.db ; @@db end
|
75
90
|
|
76
|
-
def
|
91
|
+
def self.tmp ; @@tmp ||= '/tmp' end
|
77
92
|
|
78
|
-
def
|
93
|
+
def self.knives ; @@knives ||= [] end
|
79
94
|
|
80
|
-
def hipchat message, color
|
95
|
+
def self.hipchat message, color
|
81
96
|
return if @@hipchat.nil?
|
82
97
|
@@hipchat[@@hipchat_room].send @@hipchat_nick, message, \
|
83
98
|
color: color, notify: false, message_format: 'html'
|
84
99
|
end
|
85
100
|
|
86
101
|
|
87
|
-
def notify entry
|
102
|
+
def self.notify entry
|
88
103
|
color = case entry[:type]
|
89
104
|
when 'failure' ; 'red'
|
90
105
|
when 'release' ; 'purple'
|
@@ -98,7 +113,7 @@ module KitchenHooks
|
|
98
113
|
# error == true => success
|
99
114
|
# error == false => nop
|
100
115
|
# otherwise => failure
|
101
|
-
def mark event, type, error=nil
|
116
|
+
def self.mark event, type, error=nil
|
102
117
|
return if error == false
|
103
118
|
error = nil if error == true
|
104
119
|
entry = { type: type, event: event }
|
@@ -111,14 +126,14 @@ module KitchenHooks
|
|
111
126
|
end
|
112
127
|
|
113
128
|
|
114
|
-
def process_release version=KitchenHooks::VERSION
|
129
|
+
def self.process_release version=KitchenHooks::VERSION
|
115
130
|
return if db['meta_version'] == version
|
116
131
|
db.set! 'meta_version', version
|
117
132
|
mark version, 'release'
|
118
133
|
end
|
119
134
|
|
120
135
|
|
121
|
-
def process event
|
136
|
+
def self.process event
|
122
137
|
if event.nil? # JSON parse failed
|
123
138
|
mark event, 'failure', 'Could not parse WebHook payload'
|
124
139
|
return
|
@@ -7,33 +7,33 @@ require 'json'
|
|
7
7
|
require 'git'
|
8
8
|
require 'ridley'
|
9
9
|
require 'berkshelf'
|
10
|
+
require 'sinatra/base'
|
10
11
|
|
11
12
|
|
12
13
|
Celluloid.logger = nil
|
13
14
|
Berkshelf.logger = Logger.new $stdout
|
14
15
|
|
15
16
|
module KitchenHooks
|
16
|
-
|
17
|
-
|
18
|
-
def report_error e, msg=nil
|
17
|
+
class App < Sinatra::Application
|
18
|
+
def self.report_error e, msg=nil
|
19
19
|
msg = e.message if msg.nil?
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
$stdout.puts msg
|
21
|
+
$stdout.puts e.message
|
22
|
+
$stdout.puts e.backtrace.inspect
|
23
23
|
msg
|
24
24
|
end
|
25
25
|
|
26
26
|
|
27
27
|
|
28
|
-
def perform_constraint_application event, knives
|
29
|
-
|
28
|
+
def self.perform_constraint_application event, knives
|
29
|
+
$stdout.puts 'started perform_constraint_application event=%s, knives=%s' % [
|
30
30
|
event['after'], knives.inspect
|
31
31
|
]
|
32
32
|
|
33
33
|
tmp_clone event, :tagged_commit do |clone|
|
34
34
|
Dir.chdir clone do
|
35
35
|
|
36
|
-
|
36
|
+
$stdout.puts 'Applying constraints'
|
37
37
|
constraints = lockfile_constraints 'Berksfile.lock'
|
38
38
|
environment = tag_name event
|
39
39
|
knives.each do |k|
|
@@ -44,14 +44,14 @@ module KitchenHooks
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
$stdout.puts "finished perform_constraint_application: #{event['after']}"
|
48
48
|
return # no error
|
49
49
|
end
|
50
50
|
|
51
51
|
|
52
|
-
def perform_kitchen_upload event, knives
|
52
|
+
def self.perform_kitchen_upload event, knives
|
53
53
|
return false unless commit_to_master?(event)
|
54
|
-
|
54
|
+
$stdout.puts 'started perform_kitchen_upload event=%s, knives=%s' % [
|
55
55
|
event['after'], knives.inspect
|
56
56
|
]
|
57
57
|
|
@@ -61,13 +61,13 @@ module KitchenHooks
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
|
64
|
+
$stdout.puts "finished perform_kitchen_upload: #{event['after']}"
|
65
65
|
return # no error
|
66
66
|
end
|
67
67
|
|
68
68
|
|
69
|
-
def perform_cookbook_upload event, knives
|
70
|
-
|
69
|
+
def self.perform_cookbook_upload event, knives
|
70
|
+
$stdout.puts 'started perform_cookbook_upload event=%s, knives=%s' % [
|
71
71
|
event['after'], knives.inspect
|
72
72
|
]
|
73
73
|
|
@@ -79,10 +79,10 @@ module KitchenHooks
|
|
79
79
|
raise 'Tagged version does not match cookbook version'
|
80
80
|
end
|
81
81
|
|
82
|
-
|
82
|
+
$stdout.puts 'Uploading cookbook'
|
83
83
|
with_each_knife_do "cookbook upload #{cookbook_name event} -o .. --freeze", knives
|
84
84
|
|
85
|
-
|
85
|
+
$stdout.puts 'Uploading bundled roles, environments, and data bags'
|
86
86
|
kitchen_upload knives
|
87
87
|
end
|
88
88
|
|
@@ -90,7 +90,7 @@ module KitchenHooks
|
|
90
90
|
berksfile_lock = berksfile + '.lock'
|
91
91
|
|
92
92
|
if File::exist? berksfile_lock
|
93
|
-
|
93
|
+
$stdout.puts 'Uploading dependencies'
|
94
94
|
berks_install berksfile
|
95
95
|
knives.each do |knife|
|
96
96
|
berks_upload berksfile, knife
|
@@ -98,20 +98,20 @@ module KitchenHooks
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
-
|
101
|
+
$stdout.puts "finished cookbook_upload: #{event['after']}"
|
102
102
|
return # no error
|
103
103
|
end
|
104
104
|
|
105
105
|
|
106
106
|
|
107
|
-
def kitchen_upload knives
|
108
|
-
|
107
|
+
def self.kitchen_upload knives
|
108
|
+
$stdout.puts 'Uploading data_bags'
|
109
109
|
with_each_knife_do 'upload data_bags --chef-repo-path .', knives
|
110
110
|
|
111
|
-
|
111
|
+
$stdout.puts 'Uploading roles'
|
112
112
|
with_each_knife_do 'upload roles --chef-repo-path .', knives
|
113
113
|
|
114
|
-
|
114
|
+
$stdout.puts 'Uploading environments'
|
115
115
|
Dir['environments/*'].each do |e|
|
116
116
|
knives.each do |k|
|
117
117
|
upload_environment e, k
|
@@ -120,7 +120,7 @@ module KitchenHooks
|
|
120
120
|
end
|
121
121
|
|
122
122
|
|
123
|
-
def berkshelf_config knife
|
123
|
+
def self.berkshelf_config knife
|
124
124
|
ridley = Ridley::from_chef_config knife
|
125
125
|
config = {
|
126
126
|
chef: {
|
@@ -140,15 +140,15 @@ module KitchenHooks
|
|
140
140
|
end
|
141
141
|
|
142
142
|
|
143
|
-
def berks_install berksfile
|
144
|
-
|
143
|
+
def self.berks_install berksfile
|
144
|
+
$stdout.puts 'started berks_install berksfile=%s' % berksfile.inspect
|
145
145
|
env_git_dir = ENV.delete 'GIT_DIR'
|
146
146
|
env_git_work_tree = ENV.delete 'GIT_WORK_TREE'
|
147
147
|
|
148
148
|
cmd = "berks install --debug --berksfile %s" % [
|
149
149
|
Shellwords::escape(berksfile)
|
150
150
|
]
|
151
|
-
|
151
|
+
$stdout.puts "berks_install: %s" % cmd
|
152
152
|
system cmd
|
153
153
|
raise 'Could not perform berks_install with config %s' % [
|
154
154
|
berksfile.inspect
|
@@ -156,12 +156,12 @@ module KitchenHooks
|
|
156
156
|
|
157
157
|
ENV['GIT_DIR'] = env_git_dir
|
158
158
|
ENV['GIT_WORK_TREE'] = env_git_work_tree
|
159
|
-
|
159
|
+
$stdout.puts 'finished berks_install: %s' % berksfile
|
160
160
|
end
|
161
161
|
|
162
162
|
|
163
|
-
def berks_upload berksfile, knife, options={}
|
164
|
-
|
163
|
+
def self.berks_upload berksfile, knife, options={}
|
164
|
+
$stdout.puts 'started berks_upload berksfile=%s, knife=%s' % [
|
165
165
|
berksfile.inspect, knife.inspect
|
166
166
|
]
|
167
167
|
config_path = berkshelf_config(knife)
|
@@ -169,19 +169,19 @@ module KitchenHooks
|
|
169
169
|
cmd = "berks upload --debug --berksfile %s --config %s" % [
|
170
170
|
Shellwords::escape(berksfile), Shellwords::escape(config_path)
|
171
171
|
]
|
172
|
-
|
172
|
+
$stdout.puts "berks_upload: %s" % cmd
|
173
173
|
system cmd
|
174
174
|
raise 'Could not perform berks_upload with config %s, knife %s' % [
|
175
175
|
berksfile.inspect, knife.inspect
|
176
176
|
] unless $?.exitstatus.zero?
|
177
177
|
|
178
178
|
FileUtils.rm_rf config_path
|
179
|
-
|
179
|
+
$stdout.puts 'finished berks_upload: %s' % berksfile
|
180
180
|
end
|
181
181
|
|
182
182
|
|
183
|
-
def tmp_clone event, commit_method, &block
|
184
|
-
|
183
|
+
def self.tmp_clone event, commit_method, &block
|
184
|
+
$stdout.puts 'starting tmp_clone event=%s, commit_method=%s' % [
|
185
185
|
event['after'], commit_method.inspect
|
186
186
|
]
|
187
187
|
|
@@ -193,7 +193,7 @@ module KitchenHooks
|
|
193
193
|
|
194
194
|
commit = self.send(commit_method, event)
|
195
195
|
|
196
|
-
|
196
|
+
$stdout.puts 'creating tmp_clone dir=%s, commit=%s' % [
|
197
197
|
dir.inspect, commit.inspect
|
198
198
|
]
|
199
199
|
|
@@ -202,58 +202,58 @@ module KitchenHooks
|
|
202
202
|
yield dir
|
203
203
|
|
204
204
|
FileUtils.rm_rf root
|
205
|
-
|
205
|
+
$stdout.puts 'finished tmp_clone'
|
206
206
|
end
|
207
207
|
|
208
208
|
|
209
|
-
def with_each_knife_do command, knives
|
209
|
+
def self.with_each_knife_do command, knives
|
210
210
|
with_each_knife "knife #{command} --config %{knife}", knives
|
211
211
|
end
|
212
212
|
|
213
|
-
def with_each_knife command, knives
|
213
|
+
def self.with_each_knife command, knives
|
214
214
|
knives.map do |k|
|
215
215
|
cmd = command % { knife: Shellwords::escape(k) }
|
216
|
-
|
216
|
+
$stdout.puts 'with_each_knife: %s' % cmd
|
217
217
|
system cmd
|
218
218
|
# No error handling here; do that on "berks upload"
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
222
222
|
|
223
|
-
def get_environment environment, knife
|
223
|
+
def self.get_environment environment, knife
|
224
224
|
ridley = Ridley::from_chef_config knife
|
225
225
|
ridley.environment.find environment
|
226
226
|
end
|
227
227
|
|
228
228
|
|
229
|
-
def verify_constraints constraints, environment, knife
|
230
|
-
|
229
|
+
def self.verify_constraints constraints, environment, knife
|
230
|
+
$stdout.puts 'started verify_constraints environment=%s, knife=%s' % [
|
231
231
|
environment.inspect, knife.inspect
|
232
232
|
]
|
233
233
|
chef_environment = get_environment environment, knife
|
234
234
|
unless constraints == chef_environment.cookbook_versions
|
235
235
|
raise 'Environment did not match constraints'
|
236
236
|
end
|
237
|
-
|
237
|
+
$stdout.puts 'finished verify_constraints: %s' % environment
|
238
238
|
end
|
239
239
|
|
240
240
|
|
241
|
-
def apply_constraints constraints, environment, knife
|
241
|
+
def self.apply_constraints constraints, environment, knife
|
242
242
|
# Ripped from Berkshelf::Cli::apply and Berkshelf::Lockfile::apply
|
243
243
|
# https://github.com/berkshelf/berkshelf/blob/master/lib/berkshelf/cli.rb
|
244
244
|
# https://github.com/berkshelf/berkshelf/blob/master/lib/berkshelf/lockfile.rb
|
245
|
-
|
245
|
+
$stdout.puts 'started apply_constraints environment=%s, knife=%s' % [
|
246
246
|
environment.inspect, knife.inspect
|
247
247
|
]
|
248
248
|
chef_environment = get_environment environment, knife
|
249
249
|
raise 'Could not find environment "%s"' % environment if chef_environment.nil?
|
250
250
|
chef_environment.cookbook_versions = constraints
|
251
251
|
chef_environment.save
|
252
|
-
|
252
|
+
$stdout.puts 'finished apply_constraints: %s' % environment
|
253
253
|
end
|
254
254
|
|
255
255
|
|
256
|
-
def lockfile_constraints lockfile_path
|
256
|
+
def self.lockfile_constraints lockfile_path
|
257
257
|
# Ripped from Berkshelf::Cli::apply and Berkshelf::Lockfile::apply
|
258
258
|
# https://github.com/berkshelf/berkshelf/blob/master/lib/berkshelf/cli.rb
|
259
259
|
# https://github.com/berkshelf/berkshelf/blob/master/lib/berkshelf/lockfile.rb
|
@@ -262,13 +262,13 @@ module KitchenHooks
|
|
262
262
|
hash[name] = "= #{dependency.locked_version.to_s}"
|
263
263
|
hash
|
264
264
|
end
|
265
|
-
|
265
|
+
$stdout.puts 'constraints: %s -> %s' % [ lockfile_path, constraints ]
|
266
266
|
return constraints
|
267
267
|
end
|
268
268
|
|
269
269
|
|
270
|
-
def upload_environment environment, knife
|
271
|
-
|
270
|
+
def self.upload_environment environment, knife
|
271
|
+
$stdout.puts 'started upload_environment environment=%s, knife=%s' % [
|
272
272
|
environment.inspect, knife.inspect
|
273
273
|
]
|
274
274
|
# Load the local environment from a JSON file
|
@@ -294,11 +294,13 @@ module KitchenHooks
|
|
294
294
|
|
295
295
|
# Make it so!
|
296
296
|
chef_environment.save
|
297
|
-
|
297
|
+
$stdout.puts 'finished upload_environment: %s' % environment
|
298
298
|
end
|
299
299
|
|
300
300
|
|
301
|
-
def notification
|
301
|
+
def notification e ; App.notification e end
|
302
|
+
|
303
|
+
def self.notification entry
|
302
304
|
return entry[:error] if entry[:error]
|
303
305
|
event = entry[:event]
|
304
306
|
case entry[:type]
|
@@ -314,7 +316,9 @@ module KitchenHooks
|
|
314
316
|
end
|
315
317
|
|
316
318
|
|
317
|
-
def generic_details
|
319
|
+
def generic_details e ; App.generic_details e end
|
320
|
+
|
321
|
+
def self.generic_details event
|
318
322
|
return if event.nil?
|
319
323
|
%Q|
|
320
324
|
<i>#{author(event)}</i> pushed #{push_details(event)}
|
@@ -322,7 +326,9 @@ module KitchenHooks
|
|
322
326
|
end
|
323
327
|
|
324
328
|
|
325
|
-
def push_details
|
329
|
+
def push_details e ; App.push_details e end
|
330
|
+
|
331
|
+
def self.push_details event
|
326
332
|
return if event.nil?
|
327
333
|
%Q|
|
328
334
|
<a href="#{gitlab_url(event)}">#{event['after']}</a> to <a href="#{repo_url(event)}">#{repo_name(event)}</a>
|
@@ -330,84 +336,87 @@ module KitchenHooks
|
|
330
336
|
end
|
331
337
|
|
332
338
|
|
333
|
-
def author event
|
339
|
+
def self.author event
|
334
340
|
event['user_name']
|
335
341
|
end
|
336
342
|
|
337
343
|
|
338
|
-
def repo_name event
|
344
|
+
def self.repo_name event
|
339
345
|
File::basename event['repository']['url'], '.git'
|
340
346
|
end
|
341
347
|
|
342
348
|
|
343
|
-
def cookbook_name event
|
349
|
+
def self.cookbook_name event
|
344
350
|
repo_name(event).sub /^(app|base|realm|fork)_/, 'bjn_'
|
345
351
|
end
|
346
352
|
|
347
353
|
|
348
|
-
def cookbook_repo? event
|
354
|
+
def self.cookbook_repo? event
|
349
355
|
repo_name(event) =~ /^(app|base|realm|fork)_/
|
350
356
|
end
|
351
357
|
|
352
358
|
|
353
|
-
def repo_url event
|
359
|
+
def self.repo_url event
|
354
360
|
git_daemon_style_url(event).sub(/^git/, 'http').sub(/\.git$/, '')
|
355
361
|
end
|
356
362
|
|
357
363
|
|
358
|
-
def git_daemon_style_url event
|
364
|
+
def self.git_daemon_style_url event
|
359
365
|
event['repository']['url'].sub(':', '/').sub('@', '://')
|
360
366
|
end
|
361
367
|
|
362
368
|
|
363
|
-
def gitlab_url event
|
369
|
+
def self.gitlab_url event
|
364
370
|
url = git_daemon_style_url(event).sub(/^git/, 'http').sub(/\.git$/, '')
|
365
371
|
"#{url}/commit/#{event['after']}"
|
366
372
|
end
|
367
373
|
|
368
374
|
|
369
|
-
def gitlab_tag_url event
|
375
|
+
def self.gitlab_tag_url event
|
370
376
|
url = git_daemon_style_url(event).sub(/^git/, 'http').sub(/\.git$/, '')
|
371
377
|
"#{url}/commits/#{tag_name(event)}"
|
372
378
|
end
|
373
379
|
|
374
380
|
|
375
|
-
def latest_commit event
|
381
|
+
def self.latest_commit event
|
376
382
|
event['commits'].last['id']
|
377
383
|
end
|
378
384
|
|
379
385
|
|
380
|
-
def tagged_commit event
|
386
|
+
def self.tagged_commit event
|
381
387
|
event['ref'] =~ %r{/tags/(.*)$}
|
382
388
|
return $1 # First regex capture
|
383
389
|
end
|
384
390
|
|
385
|
-
|
391
|
+
|
392
|
+
def self.tag_name event
|
393
|
+
tagged_commit event
|
394
|
+
end
|
386
395
|
|
387
396
|
|
388
|
-
def commit_to_master? event
|
397
|
+
def self.commit_to_master? event
|
389
398
|
event['ref'] == 'refs/heads/master'
|
390
399
|
end
|
391
400
|
|
392
401
|
|
393
|
-
def not_deleted? event
|
402
|
+
def self.not_deleted? event
|
394
403
|
event['after'] != '0000000000000000000000000000000000000000'
|
395
404
|
end
|
396
405
|
|
397
406
|
|
398
|
-
def commit_to_kitchen? event
|
407
|
+
def self.commit_to_kitchen? event
|
399
408
|
repo_name(event) == 'kitchen' && not_deleted?(event)
|
400
409
|
end
|
401
410
|
|
402
411
|
|
403
|
-
def tagged_commit_to_cookbook? event
|
412
|
+
def self.tagged_commit_to_cookbook? event
|
404
413
|
cookbook_repo?(event) &&
|
405
414
|
event['ref'] =~ %r{/tags/} &&
|
406
415
|
not_deleted?(event)
|
407
416
|
end
|
408
417
|
|
409
418
|
|
410
|
-
def tagged_commit_to_realm? event
|
419
|
+
def self.tagged_commit_to_realm? event
|
411
420
|
tagged_commit_to_cookbook?(event) &&
|
412
421
|
repo_name(event) =~ /^realm_/
|
413
422
|
end
|
data/lib/kitchen_hooks/main.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen_hooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Wong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hipchat
|