kitchen_hooks 1.3.2 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -2
- data/Readme.md +9 -0
- data/VERSION +1 -1
- data/etc/config.json +7 -11
- data/kitchen_hooks.gemspec +1 -1
- data/lib/kitchen_hooks/app.rb +21 -3
- data/lib/kitchen_hooks/helpers.rb +16 -0
- data/web/app/kitchen_hooks.js +1 -21
- data/web/views/app.erb +2 -7
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 566b6a40d025278b7ef874afb45a68a1e4f83bff
|
4
|
+
data.tar.gz: b756ae4e319396fe04f099488fc841d65bd8cdb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fe30aba57bb4d2c7266a6e7b0f88afb4f13981a86488b0889aa426da2370fd3cd4d83bd612055a32db43708b5e855f7ab468e90c275210cc5cba0d17541f58a
|
7
|
+
data.tar.gz: 7cbadfa56c95a712400e02c47789bd184cd45912c63b6a912ace24a3bde303ce7fb7ed6c6715e6199075cd2615e89abd46963039b3cbe80dece5c96900be0130
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kitchen_hooks (1.3.
|
4
|
+
kitchen_hooks (1.3.2)
|
5
5
|
berkshelf (~> 3)
|
6
6
|
chef (~> 11.16.4)
|
7
7
|
daybreak (~> 0.3)
|
8
8
|
git (~> 1.2)
|
9
|
-
|
9
|
+
hipchat (~> 1)
|
10
10
|
retryable (~> 1)
|
11
11
|
ridley (~> 4.1)
|
12
12
|
sinatra (~> 1.4)
|
@@ -105,7 +105,12 @@ GEM
|
|
105
105
|
git (1.2.8)
|
106
106
|
hashie (2.1.2)
|
107
107
|
highline (1.6.21)
|
108
|
+
hipchat (1.4.0)
|
109
|
+
httparty
|
108
110
|
hitimes (1.2.2)
|
111
|
+
httparty (0.13.3)
|
112
|
+
json (~> 1.8)
|
113
|
+
multi_xml (>= 0.5.2)
|
109
114
|
ipaddress (0.8.0)
|
110
115
|
json (1.8.1)
|
111
116
|
libyajl2 (1.2.0)
|
@@ -119,6 +124,7 @@ GEM
|
|
119
124
|
mixlib-config (2.1.0)
|
120
125
|
mixlib-log (1.6.0)
|
121
126
|
mixlib-shellout (1.6.1)
|
127
|
+
multi_xml (0.5.5)
|
122
128
|
multipart-post (2.0.0)
|
123
129
|
net-http-persistent (2.9.4)
|
124
130
|
net-ssh (2.9.1)
|
data/Readme.md
CHANGED
@@ -32,11 +32,20 @@ Use the `server` command to start the WebHook receiver:
|
|
32
32
|
|
33
33
|
## TODO
|
34
34
|
|
35
|
+
* Add indication of success or failure
|
36
|
+
* Add custom timeline icons to distinguish event types
|
35
37
|
* Use Ridley for data bag, role, and environment uploads to remove Chef dependency
|
36
38
|
|
37
39
|
|
38
40
|
## Changelog
|
39
41
|
|
42
|
+
### 1.4
|
43
|
+
|
44
|
+
* Simplified configuration format (breaking!)
|
45
|
+
* Added support for HipChat notifications when configured
|
46
|
+
* Linked to tag name with `.../commits/TAG` where appropriate
|
47
|
+
* Replaced "modified" with more appropriate verb where appropriate
|
48
|
+
|
40
49
|
### 1.3
|
41
50
|
|
42
51
|
* Added local database to store history (Daybreak), visualized on homepage
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
data/etc/config.json
CHANGED
@@ -1,14 +1,10 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
"
|
4
|
-
"
|
5
|
-
"
|
6
|
-
"recipient": "sclemmer@bluejeans.com"
|
2
|
+
"hipchat": {
|
3
|
+
"nick": "Kitchen (bot)",
|
4
|
+
"room": "test",
|
5
|
+
"token": "YOUR_V1_HIPCHAT_TOKEN"
|
7
6
|
},
|
8
|
-
"
|
9
|
-
|
10
|
-
|
11
|
-
"knife": "~/.chef/knife.rb"
|
12
|
-
}
|
13
|
-
]
|
7
|
+
"knives": {
|
8
|
+
"prod": "~/.chef/knife.rb"
|
9
|
+
}
|
14
10
|
}
|
data/kitchen_hooks.gemspec
CHANGED
@@ -13,10 +13,10 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.homepage = KitchenHooks::HOMEPAGE
|
14
14
|
s.license = KitchenHooks::LICENSE
|
15
15
|
|
16
|
+
s.add_runtime_dependency 'hipchat', '~> 1'
|
16
17
|
s.add_runtime_dependency 'daybreak', '~> 0.3'
|
17
18
|
s.add_runtime_dependency 'retryable', '~> 1'
|
18
19
|
s.add_runtime_dependency 'berkshelf', '~> 3'
|
19
|
-
s.add_runtime_dependency 'mime-types', '~> 1'
|
20
20
|
s.add_runtime_dependency 'chef', '~> 11.16.4'
|
21
21
|
s.add_runtime_dependency 'thor', '~> 0'
|
22
22
|
s.add_runtime_dependency 'git', '~> 1.2'
|
data/lib/kitchen_hooks/app.rb
CHANGED
@@ -2,6 +2,7 @@ require 'pathname'
|
|
2
2
|
require 'thread'
|
3
3
|
require 'json'
|
4
4
|
|
5
|
+
require 'hipchat'
|
5
6
|
require 'daybreak'
|
6
7
|
require 'sinatra/base'
|
7
8
|
|
@@ -22,8 +23,14 @@ module KitchenHooks
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def self.config! config
|
25
|
-
@@
|
26
|
-
|
26
|
+
@@hipchat = nil
|
27
|
+
if config['hipchat']
|
28
|
+
@@hipchat = HipChat::Client.new config['hipchat']['token']
|
29
|
+
@@hipchat_nick = config['hipchat']['nick'] || raise('No HipChat "nick" provided')
|
30
|
+
@@hipchat_room = config['hipchat']['room'] || raise('No HipChat "room" provided')
|
31
|
+
end
|
32
|
+
@@knives = config['knives'].map do |_, knife|
|
33
|
+
Pathname.new(knife).expand_path.realpath.to_s
|
27
34
|
end
|
28
35
|
end
|
29
36
|
|
@@ -62,6 +69,16 @@ module KitchenHooks
|
|
62
69
|
|
63
70
|
def db ; @@db end
|
64
71
|
|
72
|
+
def hipchat message, color='green', notify=false
|
73
|
+
return if @@hipchat.nil?
|
74
|
+
@@hipchat[@@hipchat_room].send @@hipchat_nick, message, \
|
75
|
+
color: color, notify: notify, message_format: 'html'
|
76
|
+
end
|
77
|
+
|
78
|
+
def notify event, type
|
79
|
+
hipchat notification(event, type)
|
80
|
+
end
|
81
|
+
|
65
82
|
def mark event, type
|
66
83
|
db.synchronize do
|
67
84
|
db[Time.now.to_f] = {
|
@@ -69,6 +86,7 @@ module KitchenHooks
|
|
69
86
|
event: event
|
70
87
|
}
|
71
88
|
end
|
89
|
+
notify event, type
|
72
90
|
end
|
73
91
|
|
74
92
|
def process event
|
@@ -80,7 +98,7 @@ module KitchenHooks
|
|
80
98
|
if tagged_commit_to_cookbook?(event) &&
|
81
99
|
tag_name(event) =~ /^v\d+/ # Tagged with version we're releasing
|
82
100
|
perform_cookbook_upload(event, knives)
|
83
|
-
mark event, '
|
101
|
+
mark event, 'cookbook upload'
|
84
102
|
end
|
85
103
|
|
86
104
|
if tagged_commit_to_realm?(event) &&
|
@@ -132,6 +132,17 @@ module KitchenHooks
|
|
132
132
|
chef_environment.save
|
133
133
|
end
|
134
134
|
|
135
|
+
def notification event, type
|
136
|
+
case type
|
137
|
+
when 'kitchen upload'
|
138
|
+
%Q| <i>#{author(event)}</i> updated <a href="#{gitlab_url(event)}">the Kitchen</a></p> |
|
139
|
+
when 'cookbook upload'
|
140
|
+
%Q| <i>#{author(event)}</i> released <a href="#{gitlab_tag_url(event)}">#{tag_name(event)}</a> of <a href="#{gitlab_url(event)}">#{repo_name(event)}</a> |
|
141
|
+
when 'constraint application'
|
142
|
+
%Q| <i>#{author(event)}</i> constrained <a href="#{gitlab_tag_url(event)}">#{tag_name(event)}</a> with <a href="#{gitlab_url(event)}">#{repo_name(event)}</a> |
|
143
|
+
end.strip
|
144
|
+
end
|
145
|
+
|
135
146
|
def author event
|
136
147
|
event['user_name']
|
137
148
|
end
|
@@ -157,6 +168,11 @@ module KitchenHooks
|
|
157
168
|
"#{url}/commit/#{event['after']}"
|
158
169
|
end
|
159
170
|
|
171
|
+
def gitlab_tag_url event
|
172
|
+
url = git_daemon_style_url(event).sub(/^git/, 'http').sub(/\.git$/, '')
|
173
|
+
"#{url}/commits/#{tag_name(event)}"
|
174
|
+
end
|
175
|
+
|
160
176
|
def latest_commit event
|
161
177
|
event['commits'].last['id']
|
162
178
|
end
|
data/web/app/kitchen_hooks.js
CHANGED
@@ -1,25 +1,5 @@
|
|
1
1
|
;(function(){
|
2
|
-
// Add relative timestamps
|
3
|
-
jQuery('.time-ago').timeago();
|
4
|
-
|
5
|
-
// Ripped from http://codyhouse.co/gem/vertical-timeline
|
6
2
|
jQuery(document).ready(function($){
|
7
|
-
|
8
|
-
|
9
|
-
// Hide timeline blocks which are outside the viewport
|
10
|
-
$timeline_block.each(function(){
|
11
|
-
if($(this).offset().top > $(window).scrollTop()+$(window).height()*0.75) {
|
12
|
-
$(this).find('.cd-timeline-img, .cd-timeline-content').addClass('is-hidden');
|
13
|
-
}
|
14
|
-
});
|
15
|
-
|
16
|
-
// On scolling, show/animate timeline blocks when enter the viewport
|
17
|
-
$(window).on('scroll', function(){
|
18
|
-
$timeline_block.each(function(){
|
19
|
-
if( $(this).offset().top <= $(window).scrollTop()+$(window).height()*0.75 && $(this).find('.cd-timeline-img').hasClass('is-hidden') ) {
|
20
|
-
$(this).find('.cd-timeline-img, .cd-timeline-content').removeClass('is-hidden').addClass('bounce-in');
|
21
|
-
}
|
22
|
-
});
|
23
|
-
});
|
3
|
+
$('.time-ago').timeago();
|
24
4
|
});
|
25
5
|
})();
|
data/web/views/app.erb
CHANGED
@@ -9,13 +9,8 @@
|
|
9
9
|
<img src="/vendor/img/cd-icon.svg" alt="Picture">
|
10
10
|
</div>
|
11
11
|
<div class="cd-timeline-content">
|
12
|
-
|
13
|
-
|
14
|
-
<p><%= author(event) %> modified <a href="<%= gitlab_url(event) %>">the Kitchen</a></p>
|
15
|
-
<% else %>
|
16
|
-
<h2><%= type %></h2>
|
17
|
-
<p><%= author(event) %> modified <a href="<%= gitlab_url(event) %>"><%= repo_name(event) %></a></p>
|
18
|
-
<% end %>
|
12
|
+
<h2><%= type %></h2>
|
13
|
+
<p><%= notification(event, type) %></p>
|
19
14
|
<span class="cd-date"><time datetime="<%= datetime %>" pubdate="pubdate" class="time-ago" title="<%= datetime %>"><%= datetime %></time></span>
|
20
15
|
</div>
|
21
16
|
</div>
|
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
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Wong
|
@@ -11,61 +11,61 @@ cert_chain: []
|
|
11
11
|
date: 2014-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: hipchat
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1'
|
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: '
|
26
|
+
version: '1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: daybreak
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: retryable
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1'
|
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: '
|
54
|
+
version: '1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: berkshelf
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '3'
|
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: '
|
68
|
+
version: '3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: chef
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|