-
Notifications
You must be signed in to change notification settings - Fork 36
/
startClients.sh
executable file
·144 lines (104 loc) · 3.24 KB
/
startClients.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
# Lists the clients and starts / delets
BASEDIR=$(dirname $0)
source "$BASEDIR/utils.sh"
cd $BASEDIR
#VERSIONS=()
VERSIONS=(6.0-NIGHTLY 6.1.0.0)
BOX_URL=${BOX_URL:-ftp.box.com/CI}
DIR=clients
CLIENTS=()
BRANCHES=()
BUILDNOS=()
# Get list of files
DIRS=$(find $DIR -type d -maxdepth 3 -d 3)
echo
echo Clients found:
echo --------------
echo
n=0;
for i in ${DIRS[@]}; do
read -a foo <<< $(echo $i | sed 's/\// /g')
CLIENTS+=(${foo[1]});
BRANCHES+=(${foo[2]});
BUILDNOS+=(${foo[3]});
echo \ [$n] ${CLIENTS[$n]}: ${BRANCHES[$n]}-${BUILDNOS[$n]}
n=$((n+1))
done
echo
# What ?
read -e -p "Select a client: " clientNo
if [ -z $clientNo ] || [ -z ${CLIENTS[$clientNo]} ]
then
echo Invalid option: $clientNo
exit 1
fi
echo
echo You selected ${CLIENTS[$clientNo]}: ${BRANCHES[$clientNo]}-${BUILDNOS[$clientNo]}
read -e -p "What do you want to do? (L)aunch it, (D)elete it, or (S)end to docker? [L]: " operation
operation=${operation:-L}
if ! [ $operation == "L" ] && ! [ $operation == "D" ] && ! [ $operation == "S" ]
then
echo Invalid selection
exit 1;
fi
# Are we deleting it?
if [ $operation == "D" ]
then
rm -rf $DIR/${CLIENTS[$clientNo]}/${BRANCHES[$clientNo]}/${BUILDNOS[$clientNo]}
echo Removed successfully
exit 0
fi
# Are we launching it?
if [ $operation == "L" ]
then
cd $DIR/${CLIENTS[$clientNo]}/${BRANCHES[$clientNo]}/${BUILDNOS[$clientNo]}
# This is the part where we need to be specific...
# PRODUCTS=(pdi-ee-client pdi-ce prd-ee prd-ce pme-ee pme-ce psw-ee psw-ce pad-ee pad-ce)
if [ ${CLIENTS[$clientNo]} == "pdi-ee-client" ] || [ ${CLIENTS[$clientNo]} == "pdi-ce" ]
then
cd data-integration
sed -i '' -e 's/^# OPT=/OPT=/' ./spoon.sh
./spoon.sh
elif [ ${CLIENTS[$clientNo]} == "prd-ee" ] || [ ${CLIENTS[$clientNo]} == "prd-ce" ]
then
cd report-designer
./report-designer.sh
elif [ ${CLIENTS[$clientNo]} == "pme-ee" ] || [ ${CLIENTS[$clientNo]} == "pme-ce" ]
then
cd metadata-editor
./metadata-editor.sh
elif [ ${CLIENTS[$clientNo]} == "psw-ee" ] || [ ${CLIENTS[$clientNo]} == "psw-ce" ]
then
cd schema-workbench
./workbench.sh
elif [ ${CLIENTS[$clientNo]} == "pad-ee" ] || [ ${CLIENTS[$clientNo]} == "pad-ce" ]
then
cd pentaho-aggdesigner-ui
./startaggregationdesigner.sh
else
echo The author was probably lazy enough to not implement what to do with ${CLIENTS[$clientNo]}...
cd $BASEDIR
exit 1
fi
fi
# Docker magic! The reason for this is that in mac, docker host is not on the
# same network of the clients; This means we can't test the big data aspects
# of namely PDI
#
# The spark-client image from github.com:pmalves/hadoop-cluster-docker works
# specially well with this
if [ $operation == "S" ]
then
read -a OPTIONS <<< $( docker ps --format "{{.Names}}" )
promptUser "Select a running container " "0"
container=${OPTIONS[$CHOICE]}
echo Copying $DIR/${CLIENTS[$clientNo]}-${BRANCHES[$clientNo]}-${BUILDNOS[$clientNo]} to $container:/root/
cd $DIR/${CLIENTS[$clientNo]}/${BRANCHES[$clientNo]}/${BUILDNOS[$clientNo]}
docker exec $container rm -rf /root/${CLIENTS[$clientNo]}-${BRANCHES[$clientNo]}-${BUILDNOS[$clientNo]}
docker cp . $container:/root/${CLIENTS[$clientNo]}-${BRANCHES[$clientNo]}-${BUILDNOS[$clientNo]}
docker cp ~/.pentaho $container:/root/
fi
echo Done
cd $BASEDIR
exit 0