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.
This commit is contained in:
Cameron Moore 2015-11-02 14:34:18 -06:00
parent 6774079a57
commit ea3dbf3438
7 changed files with 167 additions and 32 deletions

View file

@ -11,7 +11,8 @@ If you use Slack, you can set up an "Outgoing webhook integration" to run variou
1. receive the request,
2. parse the headers, payload and query variables,
3. check if the specified rules for the hook are satisfied,
3. and finally, pass the specified arguments to the specified command.
3. and finally, pass the specified arguments to the specified command via
command line arguments or via environment variables.
Everything else is the responsibility of the command's author.