forked from canitrust/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
driver.sh
executable file
·42 lines (38 loc) · 1.18 KB
/
driver.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
#!/bin/bash
unlock_containers() {
echo true > ./driver/config/container.lock
while true; do
lock=$(grep -E "browserstack|local|exit" ./driver/config/container.lock)
if [ "$lock" == "browserstack" ]; then
docker-compose down >> /dev/null 2>&1
docker-compose up -d --build >> /dev/null 2>&1
break
elif [ "$lock" == "local" ]; then
docker-compose -f docker-compose.local.yml down >> /dev/null 2>&1
docker-compose -f docker-compose.local.yml up -d --build >> /dev/null 2>&1
break
elif [ "$lock" == "exit" ]; then
break
fi
done
}
kill_docker() {
docker-compose -f docker-compose.driver.yml down >> /dev/null 2>&1
docker-compose down >> /dev/null 2>&1
}
exit_lock() {
echo exit > ./driver/config/container.lock
}
docker-compose -f docker-compose.driver.yml down > /dev/null 2>&1
docker-compose -f docker-compose.driver.yml build > /dev/null 2>&1
unlock_containers &
docker-compose -f docker-compose.driver.yml run -T driver python /driver/driver_cli.py "$@"
exit_status=$?
if [ $exit_status -ne 0 ]; then
echo "Something wrong with Driver"
else
echo "Driver DONE"
fi
exit_lock
kill_docker
exit $exit_status