-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathsupervisor
More file actions
executable file
·70 lines (59 loc) · 1.22 KB
/
supervisor
File metadata and controls
executable file
·70 lines (59 loc) · 1.22 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
set -eu
# SUPERVISOR
# Externally-runnable workflow starter
THIS=$( cd $( dirname $0 ) ; /bin/pwd )
SUPERVISOR_HOME=$( cd $THIS/.. ; /bin/pwd )
source $SUPERVISOR_HOME/workflows/common/sh/utils.sh
LOG_NAME="supervisor"
usage()
{
log "usage: $ supervisor <SITE> <WORKFLOW> <TEST_SCRIPT>"
log " $ supervisor -H # to print SUPERVISOR_HOME"
}
WAIT=""
export VERBOSITY=${VERBOSITY:-0}
while getopts "hHwv" OPT
do
case $OPT in
h)
usage
exit
;;
H)
echo $SUPERVISOR_HOME
exit
;;
w)
WAIT="-w"
;;
v)
(( ++VERBOSITY ))
;;
*)
# Bash prints an error
exit 1
esac
done
shift $(( OPTIND - 1))
if (( ${#} < 3 ))
then
error "insufficient arguments!"
usage
exit 1
fi
SITE=$1
WORKFLOW=$2
TEST_SCRIPT=$3
echo "supervisor: running workflow: " $WORKFLOW
if ! [[ -d $SUPERVISOR_HOME/workflows/$WORKFLOW ]]
then
crash "no such workflow: '$WORKFLOW'"
fi
sv_path_prepend $PWD
sv_path_append $SUPERVISOR_HOME/workflows/$WORKFLOW/test
sv_path_append $SUPERVISOR_HOME/workflows/common/sh
export SUPERVISOR_PATH
SUBTOOL=$SUPERVISOR_HOME/workflows/$WORKFLOW/sv
debug $VERBOSITY "Running $SUBTOOL ..."
$SUBTOOL $WAIT $SITE $TEST_SCRIPT