webhookd 0.0.7 → 0.0.8

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: 117c81bc0145b051d53dd51e0c85b54c99cc546a
4
- data.tar.gz: d1874340cf8f379b5f2e7d9d2f76d7da699dab54
3
+ metadata.gz: be015c3eefbb47481f8dfc39b40dfa7d9f1a88f1
4
+ data.tar.gz: 68d5c088ba11143893aedccf9f8b735704658d69
5
5
  SHA512:
6
- metadata.gz: 59510634125b6e8de310ba419c9b05867dfa6fab2892a472475c888a0bb1d04dc62cf85e6ba0fb58f2eb826ae125e86fd4eff67092d708c3771a9029894ec146
7
- data.tar.gz: b2ad48474b9d31a74e171abf5d9b57d1d084821b22142689ff7f6e2e40a86489c1bb68a689556f012be7f8d4fdb61a081885ea400b8a56e7eb943b591cb48d71
6
+ metadata.gz: c5afc2914a4114983cb50b9c7a6909e671719143cd8c9a1ed67f49a2bd24bf633850c15f5eaa3ffa86d5372b906eaac8bab6cc8ea8e53493ad5e4a63ee6bcf38
7
+ data.tar.gz: 9cc1d79f8301ff6cdb0d8d52143093486a444c35ffd89a9c8e324c7ba6d3674dedbaa068eac4ab0d76d63955479c6f2dc934d0e2ac6bcadf7dcf8887eebe87ee
@@ -1,3 +1,8 @@
1
+ # v0.0.8 ( (February 04, 2015)
2
+
3
+ * Improved logging
4
+ * New payload type: "debug"
5
+
1
6
  # v0.0.7 (January 31, 2015)
2
7
 
3
8
  * Renaming of the project
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Webhookd
1
+ # WebhookD
2
2
 
3
3
  **Flexible, configurable universal webhook receiver**
4
4
 
@@ -129,6 +129,16 @@ vcs:
129
129
  command: 'echo this is the repo <%= repo_name.upcase %>'
130
130
  ```
131
131
 
132
+ ### Webhook usage
133
+
134
+ The use a webhook, add the URL to your project.
135
+
136
+ **Available webhook payload types**
137
+
138
+ * *Bitbucket*: http(s)://USERNAME:PASSWORD@YOURIP:YOURPORT/payload/bitbucket
139
+ * *Gitlab*: http(s)://USERNAME:PASSWORD@YOURIP:YOURPORT/payload/gitlab
140
+ * *Debug*: http(s)://USERNAME:PASSWORD@YOURIP:YOURPORT/payload/debug
141
+
132
142
  ### Testing
133
143
 
134
144
  There are some tests in place using `minitest`. Run `rake test` to run all available test.
@@ -152,6 +162,7 @@ For an example have a look at `lib/webhookd/payloadtype/bitbucket.rb`.
152
162
  Adding a new type would involve the following steps:
153
163
  1. Write a payload parser in `lib/webhookd/payloadtype/`
154
164
  1. Add business logic for the payload type in `lib/webhookd/app.rb` under `case parsed_data[:type]`
165
+ 1. Update README.md
155
166
 
156
167
  ### Payload parser
157
168
 
@@ -170,7 +181,69 @@ data[:branch_name]
170
181
  data[:author_name]
171
182
  ```
172
183
 
173
- ## TODO / Ideas
184
+ **debug**
185
+
186
+ The `debug` payload type has the following hash signature:
187
+
188
+ ```ruby
189
+ data[:type]
190
+ ```
191
+
192
+ It can be used to develop a new payload type or payload parser.
193
+ When using this payload type, it just outputs the request body
194
+ in the logfile under the loglevel `debug`.
195
+
196
+ ## Packaging
197
+
198
+ ### Debian
199
+
200
+ Some very basic Debian packaging effort can be found under [tobru/webhookd-debian-packaging](https://github.com/tobru/webhookd-debian-packaging).
201
+ This is how the initial package creation was done:
202
+
203
+ ```
204
+ export DEBFULLNAME="My Name"
205
+ export DEBEMAIL="email@address.com"
206
+ gem fetch webhookd
207
+ gem2deb -p webhookd webhookd*.gem
208
+ cd webhookd-<VERSION>
209
+ git init
210
+ git-import-orig ../webhookd_*.orig.tar.gz --pristine-tar
211
+ cd ..
212
+ mv webhookd-<VERSION> webhookd
213
+ cd webhookd
214
+
215
+ # EDIT .gitignore
216
+ vi .gitignore
217
+
218
+ # add following lines
219
+ /debian/webhookd.postinst.debhelper
220
+ /debian/webhookd.postrm.debhelper
221
+ /debian/webhookd.prerm.debhelper
222
+ /debian/webhookd.substvars
223
+ /debian/webhookd
224
+ /debian/files
225
+ /.pc
226
+ Gemfile.lock
227
+
228
+ :wq
229
+ # END EDIT
230
+
231
+ git add .
232
+ git commit -a
233
+ git-buildpackage -us -uc
234
+ ```
235
+
236
+ After changes to the packaging process (`/debian` folder):
237
+ ```
238
+ dch -v <upstreamver>-<incrementpkgrel>
239
+ git commit -a
240
+ rm Gemfile.lock
241
+ git-buildpackage -us -uc
242
+ ```
243
+
244
+ If there is a new upstream version:
245
+ ```
246
+ gem fetch webhookd && gem2deb webhookd*.gem ; git-import-orig
247
+ dch -v <upstreamver>-<incrementpkgrel>
248
+ ```
174
249
 
175
- * Regex match for repository and branch names
176
- * Notification mechanism (jabber, irc)
@@ -16,4 +16,5 @@ vcs:
16
16
  encdata:
17
17
  master:
18
18
  command: 'git pull'
19
+ debug:
19
20
 
@@ -129,6 +129,8 @@ module Webhookd
129
129
  command_runner.run
130
130
  end
131
131
  # we don't know the type of this known payload
132
+ when 'debug'
133
+ logger.info "payload type was debug, see debug loglevel"
132
134
  else
133
135
  error_msg = "webhook payload type #{parsed_data[:type]} unknown"
134
136
  logger.fatal error_msg
@@ -137,7 +139,7 @@ module Webhookd
137
139
  # this type of payload is not configured
138
140
  else
139
141
  error_msg = "webhook payload of type #{parsed_data[:type]} not configured"
140
- logger.info error_msg
142
+ logger.error error_msg
141
143
  halt 500, "#{error_msg}\n"
142
144
  end
143
145
 
@@ -15,10 +15,10 @@ module Webhookd
15
15
  logger.info "Running command: #{@command}"
16
16
  Open3::popen2e(@command) { |stdin, stdout_err, wait_thr|
17
17
  while line = stdout_err.gets
18
- logger.debug("Command output: #{line.strip}")
18
+ logger.info("STDOUTERR: #{line.strip}")
19
19
  end
20
20
  if wait_thr.value.success?
21
- logger.info "command successful"
21
+ logger.info "command successfully finished"
22
22
  return true
23
23
  else
24
24
  logger.error "command failed"
@@ -26,7 +26,7 @@ module Webhookd
26
26
  end
27
27
  }
28
28
  rescue Exception => e
29
- logger.fatal "Completely failed: #{e.message}"
29
+ logger.fatal "command running completely failed: #{e.message}"
30
30
  end
31
31
  end
32
32
  end
@@ -34,7 +34,7 @@ module Webhookd
34
34
  data[:branch_name] = branch_name
35
35
  data[:author_name] = author_name
36
36
 
37
- logger.debug "parsed from the bitbucket data: #{data}"
37
+ logger.info "parsed from the bitbucket data: #{data}"
38
38
 
39
39
  # return the hash
40
40
  data
@@ -0,0 +1,21 @@
1
+ require 'webhookd/logging'
2
+ module Webhookd
3
+ class ParsePayload
4
+
5
+ include Logging
6
+
7
+ def initialize(payload)
8
+ @payload = payload
9
+ end
10
+
11
+ def parse
12
+ logger.debug 'parsing payload type debug'
13
+ logger.debug "raw received data: #{@payload}"
14
+
15
+ data = Hash.new
16
+ data[:type] = 'debug'
17
+
18
+ data
19
+ end
20
+ end
21
+ end
@@ -22,7 +22,7 @@ module Webhookd
22
22
  data[:branch_name] = json_parsed['ref'].split("/")[2]
23
23
  data[:author_name] = json_parsed['user_name']
24
24
 
25
- logger.debug "parsed from the gitlab data: #{data}"
25
+ logger.info "parsed from the gitlab data: #{data}"
26
26
 
27
27
  # return the hash
28
28
  data
@@ -1,3 +1,3 @@
1
1
  module Webhookd
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -5,7 +5,7 @@
5
5
  # Required-Start: $network $syslog
6
6
  # Required-Stop:
7
7
  # Default-Start: 2 3 4 5
8
- # Default-Stop:
8
+ # Default-Stop: 0 1 6
9
9
  # Short-Description: Starts up the webhookd server
10
10
  ### END INIT INFO
11
11
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webhookd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Brunner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-31 00:00:00.000000000 Z
11
+ date: 2015-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -139,6 +139,7 @@ files:
139
139
  - lib/webhookd/configuration.rb
140
140
  - lib/webhookd/logging.rb
141
141
  - lib/webhookd/payloadtype/bitbucket.rb
142
+ - lib/webhookd/payloadtype/debug.rb
142
143
  - lib/webhookd/payloadtype/gitlab.rb
143
144
  - lib/webhookd/version.rb
144
145
  - scripts/test/curl-bitbucket-explicit-repo-and-branch.sh