Add timeout to nc command, as it was waiting forever and not going through the while loop. This will make sure nc gets restared to retry in case something nasty is happening in the running process

host command not present in build env, switch to getent
second phase of dep download turning some error, print failure log

Signed-off-by: Daan Hoogland <daan@onecht.net>
This commit is contained in:
Rafael da Fonseca 2015-06-18 23:54:53 +02:00 committed by Daan Hoogland
parent c1c0382bf5
commit 7838bfcc70
2 changed files with 5 additions and 4 deletions

View File

@ -99,7 +99,7 @@ do
fi fi
echo -e "\nDependency download failed" echo -e "\nDependency download failed"
#Test DNS record #Test DNS record
host repo1.maven.org getent hosts repo1.maven.org
while ! nc -vzw 5 repo1.maven.org 80; do echo -e "\nFailed to connect to repo1.maven.org:80 will retry in 10 seconds"; sleep 10; done while ! nc -vzw 5 repo1.maven.org 80; do echo -e "\nFailed to connect to repo1.maven.org:80 will retry in 10 seconds"; sleep 10; done
done done
@ -111,14 +111,15 @@ echo -e "$(cat pom.xml |wc -l) lines in dummy pom.xml"
for ((i=0;i<$RETRY_COUNT;i++)) for ((i=0;i<$RETRY_COUNT;i++))
do do
mvn org.apache.maven.plugins:maven-dependency-plugin:resolve > /dev/null mvn org.apache.maven.plugins:maven-dependency-plugin:resolve > /tmp/phase2
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
echo -e "\nProject dependencies downloaded successfully" echo -e "\nProject dependencies downloaded successfully"
break; break;
fi fi
echo -e "\nDependency download failed" echo -e "\nDependency download failed"
cat /tmp/phase2
#Test DNS record #Test DNS record
host repo1.maven.org getent hosts repo1.maven.org
while ! nc -vzw 5 repo1.maven.org 80; do echo -e "\nFailed to connect to repo1.maven.org:80 will retry in 10 seconds"; sleep 10; done while ! nc -vzw 5 repo1.maven.org 80; do echo -e "\nFailed to connect to repo1.maven.org:80 will retry in 10 seconds"; sleep 10; done
done done
cd ../.. cd ../..

View File

@ -42,6 +42,6 @@ export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=500m"
echo -e "\nStarting simulator" echo -e "\nStarting simulator"
mvn -Dsimulator -pl :cloud-client-ui jetty:run 2>&1 > /tmp/jetty-log & mvn -Dsimulator -pl :cloud-client-ui jetty:run 2>&1 > /tmp/jetty-log &
while ! nc -vz localhost 8096 2>&1 > /dev/null; do grep Exception /tmp/jetty-log; sleep 10; done while ! nc -vzw 5 localhost 8096 2>&1 > /dev/null; do grep Exception /tmp/jetty-log; sleep 10; done
echo -e "\nStarting simulator" echo -e "\nStarting simulator"
python -m marvin.deployDataCenter -i setup/dev/advanced.cfg 2>&1 || true python -m marvin.deployDataCenter -i setup/dev/advanced.cfg 2>&1 || true