first commit

This commit is contained in:
yo
2024-09-21 11:25:04 +02:00
commit a78a62b180
7 changed files with 151 additions and 0 deletions

38
files/webhook.in Executable file
View File

@ -0,0 +1,38 @@
#!/bin/sh
# PROVIDE: webhook
# REQUIRE: NETWORKING SYSLOG
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable webhook:
#
# webhook_enable="YES"
. /etc/rc.subr
desc="webhook daemon"
name=webhook
rcvar=webhook_enable
load_rc_config $name
: ${webhook_conf:=/usr/local/etc/webhook.yaml}
: ${webhook_enable:=NO}
: ${webhook_facility:=daemon}
: ${webhook_priority:=debug}
: ${webhook_user:=nobody}
pidfile=/var/run/${name}.pid
extra_commands=reload
sig_reload=USR1
procname=/usr/local/sbin/${name}
command=/usr/sbin/daemon
command_args="-S -l ${webhook_facility} -s ${webhook_priority} -t ${name} -p ${pidfile} ${procname} \
-hooks ${webhook_conf} ${webhook_options}"
start_precmd="install -o ${webhook_user} /dev/null ${pidfile}"
reload_cmd="pkill -SIGUSR1-U ${webhook_user} -F {pidfile} ${procname}"
run_rc_command "$1"

28
files/webhook.yaml.sample Normal file
View File

@ -0,0 +1,28 @@
- id: webhook
execute-command: /home/adnan/redeploy-go-webhook.sh
command-working-directory: /home/adnan/go
response-message: I got the payload!
response-headers:
- name: Access-Control-Allow-Origin
value: '*'
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-hmac-sha1
secret: mysecret
parameter:
source: header
name: X-Hub-Signature
- match:
type: value
value: refs/heads/master
parameter:
source: payload
name: ref