From 6a6e3ec46efcf727dd7ec9dd1a877ec547c7d750 Mon Sep 17 00:00:00 2001 From: Bryan Strassner Date: Fri, 8 Jun 2018 14:21:49 -0500 Subject: [PATCH] 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 --- Makefile | 2 +- tools/airflow_image_run.sh | 20 +++++++++++++++----- tools/shipyard_image_run.sh | 9 +++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 0959f62a..13070504 100644 --- a/Makefile +++ b/Makefile @@ -74,7 +74,7 @@ tests: .PHONY: run run: - $(SCRIPT) $(IMAGE) + USE_PROXY=$(USE_PROXY) PROXY=$(PROXY) $(SCRIPT) $(IMAGE) .PHONY: build_airflow build_airflow: diff --git a/tools/airflow_image_run.sh b/tools/airflow_image_run.sh index 23ebfba3..e177a393 100755 --- a/tools/airflow_image_run.sh +++ b/tools/airflow_image_run.sh @@ -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 diff --git a/tools/shipyard_image_run.sh b/tools/shipyard_image_run.sh index d04e6f8c..f52e437b 100755 --- a/tools/shipyard_image_run.sh +++ b/tools/shipyard_image_run.sh @@ -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