kitchen_hooks 1.4.3 → 1.4.4

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: 7740f833b5741e558154e506e2d14edfcd8b8a9b
4
- data.tar.gz: 8e2be0c8495189ff45ef569de3bc60db6d0688a1
3
+ metadata.gz: b114594beb93d413071b7f04b20d984b013fee6d
4
+ data.tar.gz: d2147026142adc61ea75fcf348a95c1dcd2c1381
5
5
  SHA512:
6
- metadata.gz: 2a711accc2f2e45abf641c821f2413ab00d8b5b6625c755cc5623da8eba5e8ca4226be5207acdeb5771d463131549f738ef047bc9afa07273cf62e8d817a3747
7
- data.tar.gz: bc248d2f54a32439bc72eb45d719eaddb6671ecfd3e6c7e3b6b433bd42ae0ed1906af4d913d2e06b014022f106b3ce554f77d1b4d708b507d57055997d3cac24
6
+ metadata.gz: 6c47b13b5c82f3ff7d75896a3287ff6204c961690504958364d7452e97eb6c277a6b065a0d87980303b7b1058dcb9e8d99e825e16cc159569b0577c8e6ecbf8a
7
+ data.tar.gz: 74c879521204d4df768cc1df41a43bdc47f9db4d3584d33496553c56217839ff6bb8d8ccce089231663d1c1a55df2da7a52a16593bc41495aa39234d28deea76
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kitchen_hooks (1.4.2)
4
+ kitchen_hooks (1.4.3)
5
5
  berkshelf (~> 3)
6
6
  chef (~> 11.16.4)
7
7
  daybreak (~> 0.3)
data/Readme.md CHANGED
@@ -35,6 +35,7 @@ Use the `server` command to start the WebHook receiver:
35
35
  * Add indication of success or failure
36
36
  * Add custom timeline icons to distinguish event types
37
37
  * Use Ridley for data bag, role, and environment uploads to remove Chef dependency
38
+ * Only make changes on commits to `master` branches
38
39
 
39
40
 
40
41
  ## Changelog
@@ -45,6 +46,7 @@ Use the `server` command to start the WebHook receiver:
45
46
  * Added support for HipChat notifications when configured
46
47
  * Linked to tag name with `.../commits/TAG` where appropriate
47
48
  * Replaced "modified" with more appropriate verb where appropriate
49
+ * Corrected `berks upload` functionality (`berks install` first)
48
50
 
49
51
  ### 1.3
50
52
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.3
1
+ 1.4.4
@@ -1,4 +1,5 @@
1
1
  require 'shellwords'
2
+ require 'tempfile'
2
3
  require 'json'
3
4
 
4
5
  require 'git'
@@ -12,54 +13,68 @@ module KitchenHooks
12
13
  module Helpers
13
14
  def perform_constraint_application event, knives
14
15
  tag = tag_name event
15
- tmp_clone event, :tagged_commit do
16
- logger.info 'Applying constraints'
17
- constraints = lockfile_constraints 'Berksfile.lock'
18
- environment = tag_name event
19
- knives.each do |k|
20
- apply_constraints constraints, environment, k
16
+ tmp_clone event, :tagged_commit do |dir|
17
+ Dir.chdir dir do
18
+ logger.info 'Applying constraints'
19
+ constraints = lockfile_constraints 'Berksfile.lock'
20
+ environment = tag_name event
21
+ knives.each do |k|
22
+ apply_constraints constraints, environment, k
23
+ end
21
24
  end
22
25
  end
23
26
  end
24
27
 
25
28
  def perform_kitchen_upload event, knives
26
- tmp_clone event, :latest_commit do
27
- logger.info 'Uploading data_bags'
28
- with_each_knife 'upload data_bags --chef-repo-path .', knives
29
-
30
- logger.info 'Uploading roles'
31
- with_each_knife 'upload roles --chef-repo-path .', knives
32
-
33
- logger.info 'Uploading environments'
34
- Dir['environments/*'].each do |e|
35
- knives.each do |k|
36
- upload_environment e, k
29
+ tmp_clone event, :latest_commit do |clone|
30
+ Dir.chdir clone do
31
+ logger.info 'Uploading data_bags'
32
+ with_each_knife 'upload data_bags --chef-repo-path .', knives
33
+
34
+ logger.info 'Uploading roles'
35
+ with_each_knife 'upload roles --chef-repo-path .', knives
36
+
37
+ logger.info 'Uploading environments'
38
+ Dir['environments/*'].each do |e|
39
+ knives.each do |k|
40
+ upload_environment e, k
41
+ end
37
42
  end
38
43
  end
39
44
  end
40
45
  end
41
46
 
42
47
  def perform_cookbook_upload event, knives
43
- tmp_clone event, :tagged_commit do
44
- tagged_version = tag_name(event).delete('v')
45
- cookbook_version = File.read('VERSION').strip
46
- raise unless tagged_version == cookbook_version
47
- logger.info 'Uploading cookbook'
48
- with_each_knife "cookbook upload #{cookbook_name event} -o .. --freeze", knives
49
-
50
- if File::exist?('Berksfile.lock')
48
+ berksfile = nil
49
+
50
+ tmp_clone event, :tagged_commit do |clone|
51
+
52
+ Dir.chdir clone do
53
+ tagged_version = tag_name(event).delete('v')
54
+ cookbook_version = File.read('VERSION').strip
55
+ raise unless tagged_version == cookbook_version
56
+
57
+ logger.info 'Uploading cookbook'
58
+ with_each_knife "cookbook upload #{cookbook_name event} -o .. --freeze", knives
59
+ end
60
+
61
+ berksfile = File::join clone, 'Berksfile'
62
+ berksfile_lock = berksfile + '.lock'
63
+
64
+ if File::exist? berksfile_lock
51
65
  logger.info 'Uploading dependencies'
52
66
  knives.each do |knife|
53
- berks_upload knife
67
+ berks_upload berksfile, knife
54
68
  end
55
69
  end
56
70
  end
57
71
  end
58
72
 
59
- def berks_upload knife, options={}
73
+ def berks_upload berksfile, knife, options={}
60
74
  ridley = Ridley::from_chef_config knife
61
75
  options.merge! \
62
- berksfile: 'Berksfile',
76
+ berksfile: berksfile,
77
+ debug: true,
63
78
  freeze: true,
64
79
  validate: true,
65
80
  server_url: ridley.server_url,
@@ -75,9 +90,7 @@ module KitchenHooks
75
90
  dir = File::join tmp, cookbook_name(event)
76
91
  repo = Git.clone git_daemon_style_url(event), dir, log: $stdout
77
92
  repo.checkout self.send(commit_method, event)
78
- Dir.chdir dir do
79
- yield
80
- end
93
+ yield dir
81
94
  end
82
95
  end
83
96
 
@@ -59,6 +59,7 @@ module KitchenHooks
59
59
  App.set :environment, options.environment
60
60
  App.set :port, options.port
61
61
  App.set :bind, options.bind
62
+ App.set :raise_errors, true
62
63
  App.run!
63
64
  end
64
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen_hooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Wong