From 1e9a21897a3270580687228917dc63f2309fe437 Mon Sep 17 00:00:00 2001 From: Roman Gorshunov Date: Fri, 22 Jun 2018 14:59:01 +0200 Subject: [PATCH] Unifying proxy variables for tox and docker build This patch adds proxy-related variables to tox and 'docker build' commands. Change-Id: I019bb0ff5a5eb48b0a9bec6f202a5d3022b8095c --- Makefile | 38 ++++++++++++++++++++++++++------------ tox.ini | 1 + 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 7367b627..fafc4d58 100644 --- a/Makefile +++ b/Makefile @@ -12,16 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -BUILD_CTX ?= src/bin -DOCKER_REGISTRY ?= quay.io -IMAGE_PREFIX ?= airshipit -IMAGE_TAG ?= untagged -HELM ?= helm -LABEL ?= commit-id -IMAGE_NAME := airflow shipyard -PROXY ?= http://proxy.foo.com:8080 -USE_PROXY ?= false -PUSH_IMAGE ?= false +BUILD_CTX ?= src/bin +DOCKER_REGISTRY ?= quay.io +IMAGE_PREFIX ?= airshipit +IMAGE_TAG ?= untagged +HELM ?= helm +LABEL ?= commit-id +IMAGE_NAME := airflow shipyard +PROXY ?= http://proxy.foo.com:8000 +NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local +USE_PROXY ?= false +PUSH_IMAGE ?= false IMAGE:=${DOCKER_REGISTRY}/${IMAGE_PREFIX}/$(IMAGE_NAME):${IMAGE_TAG} IMAGE_DIR:=images/$(IMAGE_NAME) @@ -79,7 +80,14 @@ run: .PHONY: build_airflow build_airflow: ifeq ($(USE_PROXY), true) - docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg http_proxy=$(PROXY) --build-arg https_proxy=$(PROXY) --build-arg ctx_base=$(BUILD_CTX) . + docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile \ + --build-arg http_proxy=$(PROXY) \ + --build-arg https_proxy=$(PROXY) \ + --build-arg HTTP_PROXY=$(PROXY) \ + --build-arg HTTPS_PROXY=$(PROXY) \ + --build-arg no_proxy=$(NO_PROXY) \ + --build-arg NO_PROXY=$(NO_PROXY) \ + --build-arg ctx_base=$(BUILD_CTX) . else docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg ctx_base=$(BUILD_CTX) . endif @@ -90,7 +98,13 @@ endif .PHONY: build_shipyard build_shipyard: ifeq ($(USE_PROXY), true) - docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg ctx_base=$(BUILD_CTX) . --build-arg http_proxy=$(PROXY) --build-arg https_proxy=$(PROXY) + docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg ctx_base=$(BUILD_CTX) \ + --build-arg http_proxy=$(PROXY) \ + --build-arg https_proxy=$(PROXY) \ + --build-arg HTTP_PROXY=$(PROXY) \ + --build-arg HTTPS_PROXY=$(PROXY) \ + --build-arg no_proxy=$(NO_PROXY) \ + --build-arg NO_PROXY=$(NO_PROXY) . else docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg ctx_base=$(BUILD_CTX) . endif diff --git a/tox.ini b/tox.ini index 5bd4c002..9d0590f4 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,7 @@ envlist = all_jobs, docs [testenv] setenv= PYTHONWARNING=all +passenv=HTTP_PROXY HTTPS_PROXY http_proxy https_proxy NO_PROXY no_proxy basepython=python3.5 # Please use `make docs` instead