summaryrefslogtreecommitdiff
path: root/src/cicd-post-receive
blob: db5b723c4ae8a9fa2a8a084b71685ad9a0fcedb8 (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
#!/bin/sh
set -eu



read -r _oldrev SHA REFNAME

if [ "$SHA" = '0000000000000000000000000000000000000000' ]; then
	exit
fi


DEPLOY_OPT=
for n in `seq 0 $((GIT_PUSH_OPTION_COUNT - 1))`; do
	opt="$(eval "printf '%s' \"\$GIT_PUSH_OPTION_$n\"")"
	case "$opt" in
		(ci.skip)
			cat <<-EOF >&2

				"$opt" option detected, not running CI.

			EOF
			exit
			;;
		(deploy.skip)
			DEPLOY_OPT=-n
			;;
		(*)
			;;
	esac
done


sudo -u cicd cicd add $DEPLOY_OPT -V "$SHA" -R "$REFNAME" "$PWD"