aboutsummaryrefslogtreecommitdiff
path: root/www/webhook/files/webhook.yaml
blob: c3de043b97e669e9a5ceaf66ba63642313997dc9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
# See https://github.com/adnanh/webhook/wiki for further information on this
# file and its options.  Instead of YAML, you can also define your
# configuration as JSON.  We've picked YAML for these examples because it
# supports comments, whereas JSON does not.
#
# In the default configuration, webhook runs as user nobody.  Depending on
# the actions you want your webhooks to take, you might want to run it as
# user root.  Set the rc.conf(5) variable webhook_user to the desired user,
# and restart webhook.

# An example for a simple webhook you can call from a browser or with
# wget(1) or curl(1):
#   curl -v 'localhost:9000/hooks/samplewebhook?secret=geheim'
- id: samplewebhook
  execute-command: /usr/bin/logger
  pass-arguments-to-command:
  - source: string
    name: '-p'
  - source: string
    name: 'daemon.notice'
  - source: string
    name: '-t'
  - source: string
    name: 'samplewebhook'
  - source: string
    name: 'Sample webhook has been invoked. User Agent:'
  - source: header
    name: 'user-agent'
  response-message: |
    Example webhook executed
  trigger-rule-mismatch-http-response-code: 400
  trigger-rule:
    match:
      type: value
      value: geheim
      parameter:
        source: url
        name: secret

# Running an Ansible playbook on pushing to Github, courtesy of Dave
# Cottlehuber.
- id: ansible
  execute-command: "/home/ansible/src/ansible/deploy.sh"
  command-working-directory: "/home/ansible/src/ansible"
  pass-arguments-to-command:
  - source: payload
    name: head_commit.id
  - source: payload
    name: pusher.name
  - source: payload
    name: pusher.email
  trigger-rule:
    and:
    - match:
        type: payload-hash-sha1
        secret: .....
        parameter:
          source: header
          name: X-Hub-Signature
    - match:
        type: value
        value: refs/heads/master
        parameter:
          source: payload
          name: ref