Commit graph

147 commits

Author SHA1 Message Date
Adnan Hajdarević
04a2b2a680 Update README.md 2016-03-09 14:12:37 +01:00
Adnan Hajdarevic
4914a4131f Merge branch 'master' into development 2016-02-27 22:16:28 +01:00
Adnan Hajdarevic
37698e63b6 add support for setting global response headers using -header flag
add support for setting response headers for a successfuly triggered hook
2016-02-27 22:13:09 +01:00
Adnan Hajdarević
80aa9800bf Merge pull request #64 from adnanh/development
Update README.md to include Dockerfile discussion
2016-02-04 15:13:07 +01:00
Adnan Hajdarević
f620cb056b Update README.md 2016-02-04 15:12:24 +01:00
Adnan Hajdarević
e55e7efe14 Merge pull request #62 from adnanh/development
Update README.md
2015-12-29 20:39:41 +01:00
Adnan Hajdarević
9fa02f7341 Update README.md 2015-12-29 20:38:36 +01:00
Adnan Hajdarevic
f59f0a5c84 - added omitempty to json fields 2015-12-27 20:05:52 +01:00
Adnan Hajdarević
5594a62f8f Merge pull request #61 from adnanh/development
- added omitempty to json fields
2015-12-27 20:04:03 +01:00
Adnan Hajdarevic
642516d46e Merge branch 'master' into development 2015-11-27 09:57:44 +01:00
Adnan Hajdarevic
9cef8ed882 add omitempty to json fields 2015-11-21 17:06:02 +01:00
Adnan Hajdarević
8de1a51926 Merge pull request #56 from adnanh/development
Bugfixes
2015-11-19 12:35:16 +01:00
Adnan Hajdarević
ed9d557a13 Merge pull request #55 from moorereason/fixenv
Fix environment and argument passing
2015-11-19 09:53:31 +01:00
Cameron Moore
d2e315d9c6 Fix environment and argument passing
Two issues are addressed in this commit:

1. Instead of only sending the predefined environment arguments, this
commit appends the arguments to the existing OS environment.  Fixes #53.

2. If an argument is not found in the payload, allow the command to run
and pass in an empty string as a placeholder.  Fixes #54.

Additionally, I replaced `hook.ErrInvalidPayloadSignature` with a new
`SignatureError` type so that we can embed the signature in the error.
2015-11-18 12:00:47 -06:00
Adnan Hajdarević
a7aa7f2327 Merge pull request #52 from adnanh/development
2.3.6
2015-11-13 09:26:08 +01:00
Adnan Hajdarevic
82bba7ba07 bump up the version 2015-11-13 09:24:17 +01:00
Adnan Hajdarevic
8a9ff6d06c removed makefile conflict 2015-11-11 09:50:36 +01:00
Adnan Hajdarević
3080fd115b Merge pull request #51 from moorereason/focus
Remove webhook-contrib content and update README
2015-11-11 09:44:05 +01:00
Cameron Moore
b314eda1f9 Remove webhook-contrib content and update README
The Docker, Travis-CI, RPM, and init files are being moved to the
separate `webhook-contrib` repository.
2015-11-06 15:09:29 -06:00
Adnan Hajdarević
8544653787 Merge pull request #49 from moorereason/earlyreturn
Remove unnecessary else clause
2015-11-03 21:14:32 +01:00
Cameron Moore
8d1498e285 Remove unnecessary else clause 2015-11-03 10:48:16 -06:00
Adnan Hajdarević
2ed15e35bc Merge pull request #48 from almir/development
Adjust Makefile syntax and add docker section in README.md
2015-11-03 10:13:46 +01:00
almir
aff3a155d7 - fix hooks.json file name in readme 2015-11-03 09:28:42 +01:00
almir
5f041cb9ae - add docker section to readme 2015-11-03 09:25:53 +01:00
almir
b7081f3934 - adjust Makefile syntax 2015-11-03 09:07:38 +01:00
Adnan Hajdarević
2026328c56 Merge pull request #47 from moorereason/hookecho
Add environment arguments and improve testing
2015-11-02 22:32:27 +01:00
Cameron Moore
ea3dbf3438 Add environment arguments and improve testing
There's a lot in this commit.

 1. Add `pass-environment-to-command` option that works much like
 `pass-arguments-to-command`.  You can see an example usage in the
 "github" test case.

 2. Add a test program called "hookecho" that is used to test the
 webhook package instead of relying upon a system `echo` command.

 3. Move hooks_test.json to a template so that we can update the path to
 hookecho on the fly.

 4. Don't return an error at the end of hook.MatchRule.Evaluate().  All
 tests succeed for me now.
2015-11-02 15:11:23 -06:00
Adnan Hajdarević
6774079a57 Merge pull request #46 from moorereason/testing
Add testing framework for main webhook app
2015-10-31 09:29:34 +01:00
Adnan Hajdarević
334fbc814c Merge pull request #45 from moorereason/signals
Refactor signal handling and Windows support
2015-10-31 09:29:22 +01:00
Cameron Moore
802f3f572c Add testing framework for main webhook app
This commit adds a testing framework modeled after the godoc tests. It builds
webhook in a temporary directory, runs it with the supplied `hooks_test.json`
configuration, and then tests different payloads.  I use `/bin/echo` for the
test executable, so I've added build tags to exclude Windows.

Three minor (I hope) changes in functionality:

- I ended up moving everything from `init()` to `main()` because `init()` was
  firing while trying to build the tests, and it was dying since `hooks.json`
  didn't exist. I'm still not 100% sure `init()` was firing, but I didn't see
  any real need for anything to be in `init()` in the first place.

- make sure logger is using `os.Stderr`

- don't send `http.StatusBadRequest` when the Hook rules don't match.  "Bad
  Request" is used to identify malformed requests.  The request was properly
  formed and processed, so I think we should send back `http.StatusOK`.  For
  example, if I setup a webhook rule to only execute when commits are made to
  the `master` branch, we shouldn't send back `http.StatusBadRequest` when we
  ingest a payload for the `development` branch.

The test payloads are pretty verbose and could probably be shortened, but I kind
of like having an example payload for each service.  We can pare them down if we
want to do more focused, minimalist testing.
2015-10-30 21:32:48 -05:00
Adnan Hajdarević
6da00561bf Merge pull request #44 from timhughes/master
Pull request into development instead of master
2015-10-30 17:25:58 +01:00
Adnan Hajdarević
2e40847eb9 Merge pull request #43 from adnanh/revert-42-master
Revert "adding rpm spec file and sysv init script"
2015-10-30 17:22:48 +01:00
Adnan Hajdarević
5f7dd7211b Revert "adding rpm spec file and sysv init script" 2015-10-30 17:22:38 +01:00
Adnan Hajdarević
db25fcd06d Merge pull request #42 from timhughes/master
adding rpm spec file and sysv init script
2015-10-30 17:22:03 +01:00
Tim Hughes
d1b4ef767a Add travis test status badge to README.md 2015-10-30 01:17:06 +00:00
Tim Hughes
64b3256408 enable unit tests and add in init script and example hooks.json file to rpmspec 2015-10-30 00:49:38 +00:00
Tim Hughes
bfe4c148a5 add in make target 2015-10-29 21:58:29 +00:00
Tim Hughes
033764601d typo in travis.yml 2015-10-29 21:51:43 +00:00
Tim Hughes
8173f4a346 add travis.yml 2015-10-29 21:50:46 +00:00
Tim Hughes
ffd05a2101 adding a rpm spec file and init script 2015-10-29 21:43:13 +00:00
Adnan Hajdarević
fea31474bd Merge pull request #41 from moorereason/devsidefx
Remove logging side-effects from hook package
2015-10-29 19:05:15 +01:00
Cameron Moore
1c319a7a08 Refactor signal handling and Windows support
This commit drops webhook_windows.go in favor of simply pulling out the
signal handling code to separate files.
2015-10-29 11:17:15 -05:00
Cameron Moore
2947e5e0e8 Remove logging side-effects from hook package
The hook package should be self-contained and return errors instead of
relying on the log subsystem.  This commit removes the logging
side-effects from the hook package.  Custom errors are returned that
should be transparent to the caller -- they can just treat them as
simple errors if they don't care to check the type.
2015-10-29 11:00:30 -05:00
Adnan Hajdarević
409b441c31 Merge pull request #40 from adnanh/development
Add Dockerfile & Makefile
2015-10-28 11:52:31 +01:00
Adnan Hajdarević
93505b4132 Merge pull request #39 from almir/development
- create dockerfile and makefile for building docker image
2015-10-28 11:34:11 +01:00
almir
c350784507 - create dockerfile and makefile for building docker image 2015-10-28 10:54:36 +01:00
Adnan Hajdarević
7b8cc04992 Merge pull request #38 from adnanh/development
Fail if webhook cannot load hooks when not running in verbose mode (unless -nopanic flag is used)
2015-10-04 17:08:51 +02:00
Adnan Hajdarevic
d4810bebdb Merge branch 'master' into development 2015-10-04 17:06:34 +02:00
Adnan Hajdarevic
272546bb2b add nopanic flag 2015-10-04 17:06:17 +02:00
Adnan Hajdarević
2afc6e6a54 Merge pull request #35 from ciarand/patch-1
Fix reverse build tag in webhook_windows.go
2015-07-23 17:08:10 +02:00