diff options
| author | Julian Blake Kongslie | 2020-10-30 16:04:16 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2020-10-30 17:33:31 -0700 |
| commit | 3e2d71d7b135cc6980cc10a4108130236734551e (patch) | |
| tree | ec52715eab33236c10f01ab3f47c913f110ec032 /examples/olamic-githook-post-receive | |
| download | olamic-release/1.tar.xz | |
Initial version.release/1
Diffstat (limited to 'examples/olamic-githook-post-receive')
| -rwxr-xr-x | examples/olamic-githook-post-receive | 23 |
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 | |||
| 3 | set -eu | ||
| 4 | |||
| 5 | OLAMIC_QUEUE_HOST="${OLAMIC_QUEUE_HOST:-}" | ||
| 6 | OLAMIC_QUEUE_DIR="${OLAMIC_QUEUE_DIR:-/srv/olamic/queue}" | ||
| 7 | OLAMIC_GIT_REPO="${OLAMIC_GIT_REPO:-"$(git rev-parse --absolute-git-dir)"}" | ||
| 8 | |||
| 9 | while 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 | ||
| 16 | END | ||
| 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 | ||
| 20 | END | ||
| 21 | fi | ||
| 22 | fi | ||
| 23 | done | ||
