Add options - `stream-stdout-in-response` - `stream-stdout-in-response-on-error` - `stream-command-kill-grace-period-seconds` to allow defining webhooks which dynamically stream large content back to the requestor. This allows the creation of download endpoints from scripts, i.e. running a `git archive` command or a database dump from a docker container, without needing to buffer up the original.
136 lines
3.4 KiB
Cheetah
136 lines
3.4 KiB
Cheetah
- id: github
|
|
trigger-rule:
|
|
and:
|
|
- match:
|
|
parameter:
|
|
source: header
|
|
name: X-Hub-Signature
|
|
secret: mysecret
|
|
type: payload-hash-sha1
|
|
- match:
|
|
parameter:
|
|
source: payload
|
|
name: ref
|
|
type: value
|
|
value: refs/heads/master
|
|
include-command-output-in-response: true
|
|
trigger-rule-mismatch-http-response-code: 400
|
|
execute-command: '{{ .Hookecho }}'
|
|
pass-arguments-to-command:
|
|
- source: payload
|
|
name: head_commit.id
|
|
- source: payload
|
|
name: head_commit.author.email
|
|
pass-environment-to-command:
|
|
- source: payload
|
|
name: head_commit.timestamp
|
|
command-working-directory: /
|
|
|
|
- id: bitbucket
|
|
trigger-rule:
|
|
and:
|
|
- match:
|
|
parameter:
|
|
source: payload
|
|
name: payload.canon_url
|
|
type: value
|
|
value: https://bitbucket.org
|
|
- match:
|
|
parameter:
|
|
source: payload
|
|
name: payload.repository.absolute_url
|
|
type: value
|
|
value: /webhook/testing/
|
|
- match:
|
|
parameter:
|
|
source: payload
|
|
name: payload.commits.0.branch
|
|
type: value
|
|
value: master
|
|
parse-parameters-as-json:
|
|
- source: payload
|
|
name: payload
|
|
trigger-rule-mismatch-http-response-code: 999
|
|
execute-command: '{{ .Hookecho }}'
|
|
response-message: success
|
|
include-command-output-in-response: false
|
|
command-working-directory: /
|
|
|
|
- id: gitlab
|
|
trigger-rule:
|
|
match:
|
|
parameter:
|
|
source: payload
|
|
name: ref
|
|
type: value
|
|
value: refs/heads/master
|
|
pass-arguments-to-command:
|
|
- source: payload
|
|
name: commits.0.id
|
|
- source: payload
|
|
name: user_name
|
|
- source: payload
|
|
name: user_email
|
|
execute-command: '{{ .Hookecho }}'
|
|
response-message: success
|
|
include-command-output-in-response: true
|
|
command-working-directory: /
|
|
|
|
- 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: static-params-ok
|
|
execute-command: '{{ .Hookecho }}'
|
|
include-command-output-in-response: true
|
|
pass-arguments-to-command:
|
|
- source: string
|
|
name: passed
|
|
|
|
- id: warn-on-space
|
|
execute-command: '{{ .Hookecho }} foo'
|
|
include-command-output-in-response: true
|
|
|
|
- id: stream-stdout-in-response
|
|
execute-command: '{{ .Hookecho }}'
|
|
stream-stdout-in-response: true
|
|
pass-arguments-to-command:
|
|
- source: string
|
|
name: exit=0
|
|
- source: string
|
|
name: stream=both
|
|
|
|
- id: stream-stderr-in-response-on-error
|
|
execute-command: '{{ .Hookecho }}'
|
|
stream-stdout-in-response: true
|
|
stream-stderr-in-response-on-error: true
|
|
pass-arguments-to-command:
|
|
- source: string
|
|
name: exit=1
|
|
- source: string
|
|
name: stream=stderr
|