-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-oni-pr.sh
66 lines (60 loc) · 1.63 KB
/
test-oni-pr.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
function checkBldFile {
if [ -d "ENV/build" ]; then
True
else
False
fi
}
function checkPort () {
if lsof -Pi :$1 -sTCP:LISTEN -t >/dev/null ; then
echo "Port $1 is running"
HALTLOAD=True
else
echo "Port $1 is not running"
fi
}
BASEDIR="$HOME/development/open-oni/"
BATCHSRCDIR=$BASEDIR"batches"
BATCHDESDIR="$BASEDIR/pr$1/docker/data/"
BATCHDIR="$BATCHDESDIR/batches"
HALTLOAD=False
checkPort 8983
checkPort 3306
checkPort 80
if $HALTLOAD ; then
exit
fi
cd $BASEDIR
git clone https://github.com/open-oni/open-oni.git pr$1
cd pr$1
git fetch origin pull/$1/head:pr$1
git checkout pr$1
git merge master
rsync -avzh $BATCHSRCDIR $BATCHDESDIR. &
docker-compose up -d
echo "Starting the containers, then waiting for a few seconds to let everything start building."
while [ ! -d "ENV/build" ]; do
echo "Waiting for Python Packages to start building, please wait..."
sleep 2
done
while [ -d "ENV/build" ]; do
echo "Enumerating and building Python Packages (approximately $(ls ./ENV/build 2> /dev/null | wc -l | awk '{print $1}') remaining), please wait... "
sleep 10
if ! checkBldFile; then
echo " ... seems that the build is done, checking ... "
sleep 10
fi
if ! checkBldFile; then
echo " ... seems that the build is done, checking again ... "
sleep 10
fi
done
#if [ ! -d "ENV/build" ]; then
# echo "Waiting for Python Packages to start building, please wait... "
# sleep 2
#fi
ls -1 $BATCHDIR | grep batch_ |\
sed '/^\s*$/d' | grep -Ev '^[[:space:]]*$|^#' | sed 's/\s+//g' | tr -d '\r' |\
xargs -I {} docker-compose exec -T web /load_batch.sh {}
# echo "if you would like to view the logs, 'docker-compose logs'"