forked from rundeck/rundeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-docker-tests.sh
52 lines (42 loc) · 902 Bytes
/
run-docker-tests.sh
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
#!/bin/bash
#/ trigger local ci test run
set -euo pipefail
IFS=$'\n\t'
readonly ARGS=("$@")
DOCKER_DIR=$PWD/test/docker
usage() {
grep '^#/' <"$0" | cut -c4- # prints the #/ lines above as usage info
}
die(){
echo >&2 "$@" ; exit 2
}
check_args(){
if [ ${#ARGS[@]} -gt 0 ] ; then
DOCKER_DIR=$1
fi
}
copy_jar(){
local FARGS=("$@")
local DIR=${FARGS[0]}
local buildJar=( $PWD/rundeckapp/build/libs/*.war )
echo "Testing against ${buildJar[0]}"
test -d $DIR || mkdir -p $DIR
cp ${buildJar[0]} $DIR/rundeck-launcher.war
}
run_tests(){
local FARGS=("$@")
local DIR=${FARGS[0]}
cd $DIR
bash $DIR/test.sh
}
run_docker_test(){
local FARGS=("$@")
local DIR=${FARGS[0]}
local launcherJar=$( copy_jar $DIR ) || die "Failed to copy jar"
run_tests $DIR
}
main() {
check_args
run_docker_test $DOCKER_DIR
}
main