blob: 945f055714615f637c95d60295de998b396bf306 [file] [log] [blame]
Luigi Santivettiaf512c82020-10-31 10:53:12 +00001#!/bin/bash
2
3if (return 0 2>/dev/null); then
4 echo "Do not source, instead run ${BASH_SOURCE[0]}" >&2
5else
6 export INSTANCE_MODE="release"
7 export HOST_NAME="giggi.me"
8 export INSTANCE_DIR=""
9 export MANIFEST_F="MANIFEST.container.openssh"
10 export DEFANS="n"
11
12 LOG_DIR="/config/logs"
13 TOD_DIR="/tod"
14 args="${@}"
15
16 declare -ar apache_live=( code-igniter-v3-giggi pelican-subtle-giggi mdcon )
17 declare -ar gerrit_live=( gerrit-hooks )
18
19 declare -A CHANGE=(
20 [change]=""
21 [change-url]=""
22 [change-owner]=""
23 [change-owner-username]=""
24 [project]=""
25 [branch]=""
26 [topic]=""
27 [submitter]=""
28 [submitter-username]=""
29 [commit]=""
30 [newrev]=""
31 )
32
33 set -x
34 while read -a line; do
35 for K in ${!CHANGE[@]}; do
36 if [ "${line[0]}" == "--$K" ]; then
37 CHANGE[$K]="${line[@]:1}"
38 break
39 fi
40 done
41 done <<< $(echo -e ${args// --/\\n--})
42
43 pushd $TOD_DIR >/dev/null
44 case "${CHANGE[project]}" in
45 ${apache_live[0]} | ${apache_live[1]} | ${apache_live[2]} )
46 ./tod --upmod=apache &> $LOG_DIR/tod.hooks-upmod_apache_live.txt
47 ;;
48 ${gerrit_live[0]} )
49 ./tod --upmod=gerrit &> $LOG_DIR/tod.hooks-upmod_gerrit_live.txt
50 ;;
51 esac
52 RET=$?
53 popd >/dev/null
54 set +x
55fi
56
57[ "$RET" -eq 0 ]