summaryrefslogtreecommitdiff
path: root/examples/olamic-githook-post-receive
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xexamples/olamic-githook-post-receive23
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/olamic-githook-post-receive b/examples/olamic-githook-post-receive
new file mode 100755
index 0000000..3135d0d
--- /dev/null
+++ b/examples/olamic-githook-post-receive
@@ -0,0 +1,23 @@
1#!/bin/bash
2
3set -eu
4
5OLAMIC_QUEUE_HOST="${OLAMIC_QUEUE_HOST:-}"
6OLAMIC_QUEUE_DIR="${OLAMIC_QUEUE_DIR:-/srv/olamic/queue}"
7OLAMIC_GIT_REPO="${OLAMIC_GIT_REPO:-"$(git rev-parse --absolute-git-dir)"}"
8
9while read OLD NEW REF; do
10 if git rev-parse --quiet --verify "$NEW":olamic-run > /dev/null; then
11 OLAMIC_EMAIL="$(git show --no-patch --format=%ae "$NEW")"
12 echo -n "Enqueuing olamic run for $REF: "
13 if [[ "$OLAMIC_QUEUE_HOST" == "" ]]; then
14 olamic-enqueue "$OLAMIC_QUEUE_DIR" "$OLAMIC_GIT_REPO" "$NEW" GIT_REF="$REF" OLAMIC_EMAIL="$OLAMIC_EMAIL" <<END
15. ./olamic-run
16END
17 else
18 ssh "$OLAMIC_QUEUE_HOST" olamic-enqueue "$OLAMIC_QUEUE_DIR" "$OLAMIC_GIT_REPO" "$NEW" GIT_REF="$REF" OLAMIC_EMAIL="$OLAMIC_EMAIL" <<END
19. ./olamic-run
20END
21 fi
22 fi
23done