summaryrefslogtreecommitdiffstats
path: root/jjb
diff options
context:
space:
mode:
authorTrevor Bramwell <tbramwell@linuxfoundation.org>2017-09-28 11:54:23 -0700
committerTrevor Bramwell <tbramwell@linuxfoundation.org>2017-09-29 11:05:16 -0700
commit0850024f0ea0fbe81efefae9d4a49dcf9521a73e (patch)
treec6f0ca4c8afb555da90278e8a8b3719097919d2f /jjb
parentcc6ebc086d10e708b2f33769b7e23ef6473e0542 (diff)
Keep Docker builds from thrashing on same server
There is a possiblity of multiple docker builds of a docker repo being scheduled on the same host: 1) Patch is merged 2) Docker build is triggered 3) New patch is merged before the Docker build/push finishes triggering a second build 4) First build fails as second build starts by cleaning image from first build Reintroducing the check for builds in progress, but specific to the Docker repo, should allow mulitiple Docker builds on a node to run, while keeping multiple builds on a per-repo basis from thrashing each other. JIRA: RELENG-315 Change-Id: I74c01850a036c831b93a8cd5fa8522337abb9ff4 Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Diffstat (limited to 'jjb')
-rw-r--r--jjb/releng/opnfv-docker.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/jjb/releng/opnfv-docker.sh b/jjb/releng/opnfv-docker.sh
index 954d7c8ab..298d2af51 100644
--- a/jjb/releng/opnfv-docker.sh
+++ b/jjb/releng/opnfv-docker.sh
@@ -17,6 +17,17 @@ echo "Starting opnfv-docker for $DOCKER_REPO_NAME ..."
echo "--------------------------------------------------------"
echo
+count=30 # docker build jobs might take up to ~30 min
+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
+ echo "Timeout. Aborting..."
+ exit 1
+ fi
+done
+
# Remove previous running containers if exist
if [[ -n "$(docker ps -a | grep $DOCKER_REPO_NAME)" ]]; then
echo "Removing existing $DOCKER_REPO_NAME containers..."