Add "request" source with support for "method" and "remote-addr" parameters. Both values are taken from the raw http.Request object. Fixes #312
389 lines
8.0 KiB
Cheetah
389 lines
8.0 KiB
Cheetah
[
|
|
{
|
|
"id": "github",
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"command-working-directory": "/",
|
|
"http-methods": ["Post "],
|
|
"include-command-output-in-response": true,
|
|
"trigger-rule-mismatch-http-response-code": 400,
|
|
"pass-environment-to-command":
|
|
[
|
|
{
|
|
"source": "payload",
|
|
"name": "head_commit.timestamp"
|
|
}
|
|
],
|
|
"pass-arguments-to-command":
|
|
[
|
|
{
|
|
"source": "payload",
|
|
"name": "head_commit.id"
|
|
},
|
|
{
|
|
"source": "payload",
|
|
"name": "head_commit.author.email"
|
|
}
|
|
],
|
|
"trigger-rule":
|
|
{
|
|
"and":
|
|
[
|
|
{
|
|
"match":
|
|
{
|
|
"type": "payload-hmac-sha1",
|
|
"secret": "mysecret",
|
|
"parameter":
|
|
{
|
|
"source": "header",
|
|
"name": "X-Hub-Signature"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"match":
|
|
{
|
|
"type": "value",
|
|
"value": "refs/heads/master",
|
|
"parameter":
|
|
{
|
|
"source": "payload",
|
|
"name": "ref"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"id": "bitbucket",
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"command-working-directory": "/",
|
|
"include-command-output-in-response": false,
|
|
"response-message": "success",
|
|
"trigger-rule-mismatch-http-response-code": 999,
|
|
"parse-parameters-as-json": [
|
|
{
|
|
"source": "payload",
|
|
"name": "payload"
|
|
}
|
|
],
|
|
"trigger-rule": {
|
|
"and": [
|
|
{
|
|
"match": {
|
|
"type": "value",
|
|
"parameter": {
|
|
"source": "payload",
|
|
"name": "payload.canon_url"
|
|
},
|
|
"value": "https://bitbucket.org"
|
|
}
|
|
},
|
|
{
|
|
"match": {
|
|
"type": "value",
|
|
"parameter": {
|
|
"source": "payload",
|
|
"name": "payload.repository.absolute_url"
|
|
},
|
|
"value": "/webhook/testing/"
|
|
}
|
|
},
|
|
{
|
|
"match": {
|
|
"type": "value",
|
|
"parameter": {
|
|
"source": "payload",
|
|
"name": "payload.commits.0.branch"
|
|
},
|
|
"value": "master"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"id": "gitlab",
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"command-working-directory": "/",
|
|
"response-message": "success",
|
|
"include-command-output-in-response": true,
|
|
"pass-arguments-to-command":
|
|
[
|
|
{
|
|
"source": "payload",
|
|
"name": "commits.0.id"
|
|
},
|
|
{
|
|
"source": "payload",
|
|
"name": "user_name"
|
|
},
|
|
{
|
|
"source": "payload",
|
|
"name": "user_email"
|
|
}
|
|
],
|
|
"trigger-rule":
|
|
{
|
|
"match":
|
|
{
|
|
"type": "value",
|
|
"value": "refs/heads/master",
|
|
"parameter":
|
|
{
|
|
"source": "payload",
|
|
"name": "ref"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "xml",
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"command-working-directory": "/",
|
|
"response-message": "success",
|
|
"trigger-rule": {
|
|
"and": [
|
|
{
|
|
"match": {
|
|
"type": "value",
|
|
"parameter": {
|
|
"source": "payload",
|
|
"name": "app.users.user.0.-name"
|
|
},
|
|
"value": "Jeff"
|
|
}
|
|
},
|
|
{
|
|
"match": {
|
|
"type": "value",
|
|
"parameter": {
|
|
"source": "payload",
|
|
"name": "app.messages.message.#text"
|
|
},
|
|
"value": "Hello!!"
|
|
}
|
|
},
|
|
],
|
|
}
|
|
},
|
|
{
|
|
"id": "sendgrid",
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"command-working-directory": "/",
|
|
"response-message": "success",
|
|
"trigger-rule": {
|
|
"match": {
|
|
"type": "value",
|
|
"parameter": {
|
|
"source": "payload",
|
|
"name": "root.0.event"
|
|
},
|
|
"value": "processed"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "plex",
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"command-working-directory": "/",
|
|
"response-message": "success",
|
|
"parse-parameters-as-json": [
|
|
{
|
|
"source": "payload",
|
|
"name": "payload"
|
|
}
|
|
],
|
|
"trigger-rule":
|
|
{
|
|
"match":
|
|
{
|
|
"type": "value",
|
|
"parameter": {
|
|
"source": "payload",
|
|
"name": "payload.event"
|
|
},
|
|
"value": "media.play"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "capture-command-output-on-success-not-by-default",
|
|
"pass-arguments-to-command": [
|
|
{
|
|
"source": "string",
|
|
"name": "exit=0"
|
|
}
|
|
],
|
|
"execute-command": "{{ .Hookecho }}"
|
|
},
|
|
{
|
|
"id": "capture-command-output-on-success-yes-with-flag",
|
|
"pass-arguments-to-command": [
|
|
{
|
|
"source": "string",
|
|
"name": "exit=0"
|
|
}
|
|
],
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"include-command-output-in-response": true
|
|
},
|
|
{
|
|
"id": "capture-command-output-on-error-not-by-default",
|
|
"pass-arguments-to-command": [
|
|
{
|
|
"source": "string",
|
|
"name": "exit=1"
|
|
}
|
|
],
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"include-command-output-in-response": true
|
|
},
|
|
{
|
|
"id": "capture-command-output-on-error-yes-with-extra-flag",
|
|
"pass-arguments-to-command": [
|
|
{
|
|
"source": "string",
|
|
"name": "exit=1"
|
|
}
|
|
],
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"include-command-output-in-response": true,
|
|
"include-command-output-in-response-on-error": true
|
|
},
|
|
{
|
|
"id": "request-source",
|
|
"pass-arguments-to-command": [
|
|
{
|
|
"source": "request",
|
|
"name": "method"
|
|
},
|
|
{
|
|
"source": "request",
|
|
"name": "remote-addr"
|
|
}
|
|
],
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"include-command-output-in-response": true
|
|
},
|
|
{
|
|
"id": "static-params-ok",
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"response-message": "success",
|
|
"include-command-output-in-response": true,
|
|
"pass-arguments-to-command": [
|
|
{
|
|
"source": "string",
|
|
"name": "passed"
|
|
}
|
|
],
|
|
},
|
|
{
|
|
"id": "warn-on-space",
|
|
"execute-command": "{{ .Hookecho }} foo",
|
|
"response-message": "success",
|
|
"include-command-output-in-response": true,
|
|
"pass-arguments-to-command": [
|
|
{
|
|
"source": "string",
|
|
"name": "passed"
|
|
}
|
|
],
|
|
},
|
|
{
|
|
"id": "issue-471",
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"response-message": "success",
|
|
"trigger-rule":
|
|
{
|
|
"or":
|
|
[
|
|
{
|
|
"match":
|
|
{
|
|
"parameter":
|
|
{
|
|
"source": "payload",
|
|
"name": "foo"
|
|
},
|
|
"type": "value",
|
|
"value": "bar"
|
|
}
|
|
},
|
|
{
|
|
"match":
|
|
{
|
|
"parameter":
|
|
{
|
|
"source": "payload",
|
|
"name": "exists"
|
|
},
|
|
"type": "value",
|
|
"value": 1
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"id": "issue-471-and",
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"response-message": "success",
|
|
"trigger-rule":
|
|
{
|
|
"and":
|
|
[
|
|
{
|
|
"match":
|
|
{
|
|
"parameter":
|
|
{
|
|
"source": "payload",
|
|
"name": "foo"
|
|
},
|
|
"type": "value",
|
|
"value": "bar"
|
|
}
|
|
},
|
|
{
|
|
"match":
|
|
{
|
|
"parameter":
|
|
{
|
|
"source": "payload",
|
|
"name": "exists"
|
|
},
|
|
"type": "value",
|
|
"value": 1
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"id": "empty-payload-signature",
|
|
"execute-command": "{{ .Hookecho }}",
|
|
"command-working-directory": "/",
|
|
"include-command-output-in-response": true,
|
|
"trigger-rule":
|
|
{
|
|
"and":
|
|
[
|
|
{
|
|
"match":
|
|
{
|
|
"type": "payload-hmac-sha1",
|
|
"secret": "mysecret",
|
|
"parameter":
|
|
{
|
|
"source": "header",
|
|
"name": "X-Hub-Signature"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|