fuel, armband: verify jobs: Fix race condition
[releng.git] / jjb / releng / opnfv-docker.sh
index 0de3df2..298d2af 100644 (file)
@@ -18,8 +18,8 @@ echo "--------------------------------------------------------"
 echo
 
 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..."
+while [[ -n `ps -ef| grep 'docker build' | grep $DOCKER_REPO_NAME | grep -v grep` ]]; do
+    echo "Build or cleanup of $DOCKER_REPO_NAME in progress. Waiting..."
     sleep 60
     count=$(( $count - 1 ))
     if [ $count -eq 0 ]; then
@@ -89,11 +89,19 @@ if [[ -n "${COMMIT_ID-}" && -n "${RELEASE_VERSION-}" ]]; then
     BUILD_BRANCH=$COMMIT_ID
 fi
 
+ARCH_BUILD_ARG=""
+ARCH_TAG=${ARCH_TAG:-}
+if [[ -n "${ARCH_TAG}" ]]; then
+    DOCKER_TAG=${ARCH_TAG}-${DOCKER_TAG}
+    ARCH_BUILD_ARG="--build-arg ARCH=${ARCH_TAG}"
+fi
+
 # Start the build
 echo "Building docker image: $DOCKER_REPO_NAME:$DOCKER_TAG"
 echo "--------------------------------------------------------"
 echo
 cmd="docker build --no-cache -t $DOCKER_REPO_NAME:$DOCKER_TAG --build-arg BRANCH=$BUILD_BRANCH
+    $ARCH_BUILD_ARG
     -f $DOCKERFILE ."
 
 echo ${cmd}