forked from rundeck/rundeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-docker-tests.sh
56 lines (46 loc) · 980 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
52
53
54
55
#!/bin/bash
#/ trigger local ci test run
. rd_versions.sh
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 -a VERS=( $( rd_get_version ) )
local JAR=rundeck-launcher-${VERS[0]}-${VERS[2]}.jar
local buildJar=$PWD/rundeck-launcher/launcher/build/libs/$JAR
test -f $buildJar || die "Jar file not found $buildJar"
mkdir -p $DIR
cp $buildJar $DIR/rundeck-launcher.jar
echo $DIR/$JAR
}
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