summaryrefslogtreecommitdiff
path: root/examples/olamic-githook-post-receive
diff options
context:
space:
mode:
authorJulian Blake Kongslie2020-10-30 16:04:16 -0700
committerJulian Blake Kongslie2020-10-30 17:33:31 -0700
commit3e2d71d7b135cc6980cc10a4108130236734551e (patch)
treeec52715eab33236c10f01ab3f47c913f110ec032 /examples/olamic-githook-post-receive
downloadolamic-3e2d71d7b135cc6980cc10a4108130236734551e.tar.xz
Initial version.release/1
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