kitchen_hooks 1.4.3 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Readme.md +2 -0
- data/VERSION +1 -1
- data/lib/kitchen_hooks/helpers.rb +44 -31
- data/lib/kitchen_hooks/main.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b114594beb93d413071b7f04b20d984b013fee6d
|
4
|
+
data.tar.gz: d2147026142adc61ea75fcf348a95c1dcd2c1381
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c47b13b5c82f3ff7d75896a3287ff6204c961690504958364d7452e97eb6c277a6b065a0d87980303b7b1058dcb9e8d99e825e16cc159569b0577c8e6ecbf8a
|
7
|
+
data.tar.gz: 74c879521204d4df768cc1df41a43bdc47f9db4d3584d33496553c56217839ff6bb8d8ccce089231663d1c1a55df2da7a52a16593bc41495aa39234d28deea76
|
data/Gemfile.lock
CHANGED
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.
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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:
|
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
|
-
|
79
|
-
yield
|
80
|
-
end
|
93
|
+
yield dir
|
81
94
|
end
|
82
95
|
end
|
83
96
|
|
data/lib/kitchen_hooks/main.rb
CHANGED