Add proxy options to docker run portions of image build

Updates the Makefile and associated shell scripts that perform docker
run to utilize proxy info.

Change-Id: Ic37ae9bc25500357f980ed327148eacac7555915
This commit is contained in:
Bryan Strassner 2018-06-08 14:21:49 -05:00
parent 5b1189db6e
commit 6a6e3ec46e
3 changed files with 23 additions and 8 deletions

View File

@ -74,7 +74,7 @@ tests:
.PHONY: run
run:
$(SCRIPT) $(IMAGE)
USE_PROXY=$(USE_PROXY) PROXY=$(PROXY) $(SCRIPT) $(IMAGE)
.PHONY: build_airflow
build_airflow:

View File

@ -15,12 +15,22 @@
#
set -x
IMAGE=$1
TEST_RESP="$(docker run \
-p 8080:8080 \
--name airflow_test ${IMAGE} \
quicktest)"
USE_PROXY=${USE_PROXY:-false}
if [ "${USE_PROXY}" == "true" ]; then
TEST_RESP="$(docker run \
-p 8080:8080 \
--env HTTP_PROXY="${PROXY}" \
--env HTTPS_PROXY="${PROXY}" \
--name airflow_test ${IMAGE} \
quicktest)"
else
TEST_RESP="$(docker run \
-p 8080:8080 \
--name airflow_test ${IMAGE} \
quicktest)"
fi
docker stop airflow_test
docker rm airflow_test

View File

@ -16,6 +16,7 @@
set -x
IMAGE=$1
USE_PROXY=${USE_PROXY:-false}
# Collect necessary files and run shipyard image in docker
mkdir -p build/.tmprun/etc
@ -29,9 +30,13 @@ docker run \
sleep 5
RESULT="$(curl -i 'http://127.0.0.1:9000/versions' | tr '\r' '\n' | head -1)"
RESULT="$(curl -i 'http://127.0.0.1:9000/versions' --noproxy '*' | tr '\r' '\n' | head -1)"
CLI_RESULT="$(docker run -t --rm --net=host ${IMAGE} help | tr '\r' '\n' | head -1)"
if [ "${USE_PROXY}" == "true" ]; then
CLI_RESULT="$(docker run -t --rm --net=host --env HTTP_PROXY="${PROXY}" --env HTTPS_PROXY="${PROXY}" ${IMAGE} help | tr '\r' '\n' | head -1)"
else
CLI_RESULT="$(docker run -t --rm --net=host ${IMAGE} help | tr '\r' '\n' | head -1)"
fi
docker stop shipyard_test
docker rm shipyard_test