From a50587afb806c512994f1395cdff34df53e045b2 Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Thu, 30 Mar 2017 10:51:32 +0200 Subject: Add wait method for Docker builds By default, if a docker build job triggers and there is another one running at the same time, it will abort the job. This adds a wait method with a timeout to avoid that. Change-Id: Ica86885c60ce4137c85474ec4b7441ac5bab600c Signed-off-by: jose.lausuch --- jjb/releng/opnfv-docker.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/jjb/releng/opnfv-docker.sh b/jjb/releng/opnfv-docker.sh index 9bd711bc6..5d73a9d70 100644 --- a/jjb/releng/opnfv-docker.sh +++ b/jjb/releng/opnfv-docker.sh @@ -17,14 +17,16 @@ echo "Starting opnfv-docker for $DOCKER_REPO_NAME ..." echo "--------------------------------------------------------" echo - -if [[ -n $(ps -ef|grep 'docker build'|grep -v grep) ]]; then - echo "There is already another build process in progress:" - echo $(ps -ef|grep 'docker build'|grep -v grep) - # Abort this job since it will collide and might mess up the current one. - echo "Aborting..." - exit 1 -fi +count=30 # docker build jobs might take up to ~30 min +while [[ -n `ps -ef|grep 'docker build'|grep -v grep` ]]; do + echo "Build in progress. Waiting..." + sleep 60 + count=$(( $count - 1 )) + if [ $count -eq 0 ]; then + echo "Timeout. Aborting..." + exit 1 + fi +done # Remove previous running containers if exist if [[ -n "$(docker ps -a | grep $DOCKER_REPO_NAME)" ]]; then -- cgit 1.2.3-korg