Avoid colissions between docker-build jobs 29/12629/1
authorjose.lausuch <jose.lausuch@ericsson.com>
Mon, 25 Apr 2016 09:02:11 +0000 (11:02 +0200)
committerjose.lausuch <jose.lausuch@ericsson.com>
Mon, 25 Apr 2016 09:03:50 +0000 (11:03 +0200)
Problem to be fixed: if the job detects that there is another
docker-build in progress it will exit but won't be triggered again
until it detects a new commit in the repo.

Change-Id: Ifee419f50fa9d4cb21825302688e1af3311c4bb9
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
jjb/opnfv/opnfv-docker.sh

index 8f44268..702c0ce 100644 (file)
@@ -17,6 +17,14 @@ 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 colide and might mess up the current one.
+    echo "Aborting..."
+    exit 1
+fi
+
 # Remove previous running containers if exist
 if [[ -n "$(docker ps -a | grep $DOCKER_REPO_NAME)" ]]; then
     echo "Removing existing $DOCKER_REPO_NAME containers..."