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>
# 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