-
Notifications
You must be signed in to change notification settings - Fork 13
/
run-docker-vault-tests.sh
executable file
·66 lines (55 loc) · 1.29 KB
/
run-docker-vault-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
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
#/ trigger local ci test run
set -euo pipefail
IFS=$'\n\t'
readonly ARGS=("$@")
DOCKER_DIR=$PWD/test/docker
rd_get_version(){
local CUR_VERSION=$(grep rundeck.version.number= `pwd`/version.properties | cut -d= -f 2)
echo "${CUR_VERSION}"
}
rd_get_plugin_version(){
local CUR_VERSION=$(grep plugin.version.number= `pwd`/version.properties | cut -d= -f 2)
echo "${CUR_VERSION}"
}
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_plugin_version ) )
local JAR=$(basename "$PWD")-*.jar
local buildJar=$PWD/build/libs/$JAR
test -f $buildJar || die "Jar file not found $buildJar"
mkdir -p $DIR
cp $buildJar $DIR/dockers/rundeckvault/plugins
echo $DIR/dockers/rundeckvault/plugins/$JAR
}
run_tests(){
local FARGS=("$@")
local DIR=${FARGS[0]}
cd $DIR
bash $DIR/test-vault.sh
bash $DIR/test-existing-vault.sh
}
run_docker_test(){
local FARGS=("$@")
local DIR=${FARGS[0]}
local launcherJar=$( copy_jar $DIR ) || die "Failed to copy jar"
echo "Testing: $launcherJar"
run_tests $DIR
}
main() {
check_args
run_docker_test $DOCKER_DIR
}
main