[Docker] Use build time args only for Functest 77/20477/1
authorjose.lausuch <jose.lausuch@ericsson.com>
Tue, 6 Sep 2016 15:31:14 +0000 (17:31 +0200)
committerjose.lausuch <jose.lausuch@ericsson.com>
Tue, 6 Sep 2016 15:31:14 +0000 (17:31 +0200)
Using build-time arguments on Dockerfiles which
dont use the argument throws an error:
One or more build-args [BRANCH] were not consumed, failing build.

Examples:
https://build.opnfv.org/ci/view/functest/job/functest-docker-build-push-master/lastBuild/console

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

index 860eee0..07198c6 100644 (file)
@@ -110,7 +110,12 @@ echo "Tag version to be build and pushed: $DOCKER_TAG"
 # Start the build
 echo "Building docker image: $DOCKER_REPO_NAME:$DOCKER_BRANCH_TAG"
 
-docker build --no-cache -t $DOCKER_REPO_NAME:$DOCKER_BRANCH_TAG --build-arg BRANCH=$branch .
+if [[ $DOCKER_REPO_NAME == *"functest"* ]]; then
+    docker build --no-cache -t $DOCKER_REPO_NAME:$DOCKER_BRANCH_TAG --build-arg BRANCH=$branch .
+else
+    docker build --no-cache -t $DOCKER_REPO_NAME:$DOCKER_BRANCH_TAG .
+fi
+
 echo "Creating tag '$DOCKER_TAG'..."
 docker tag -f $DOCKER_REPO_NAME:$DOCKER_BRANCH_TAG $DOCKER_REPO_NAME:$DOCKER_TAG