From 5444309405083a420533465768ab4004586f9236 Mon Sep 17 00:00:00 2001 From: Mark Dodgson Date: Wed, 4 Sep 2019 22:21:10 +0100 Subject: [PATCH] added environment argument for golang version (#1361) * added environment argument for golang version * Revert: added environment argument for golang version (84298506) * reverted to specifying go version 1.12 as the default * fix spacing --- Dockerfile.test | 5 ++++- Makefile | 11 +++++++++-- docker-compose.yml | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Dockerfile.test b/Dockerfile.test index 5be25682..9df0a7cc 100644 --- a/Dockerfile.test +++ b/Dockerfile.test @@ -1,4 +1,7 @@ -FROM golang:1.12 +ARG GOLANG_VERSION=1.12 +FROM golang:$GOLANG_VERSION + +RUN echo $GOLANG_VERSION RUN mkdir -p /athens/tests diff --git a/Makefile b/Makefile index 130721ee..28fed0e0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,10 @@ VERSION = "unset" DATE=$(shell date -u +%Y-%m-%d-%H:%M:%S-%Z) + +ifndef GOLANG_VERSION +override GOLANG_VERSION = 1.12 +endif + .PHONY: build build: ## build the athens proxy cd cmd/proxy && go build @@ -47,7 +52,8 @@ test-unit: ## run unit tests with race detector and code coverage enabled .PHONY: test-unit-docker test-unit-docker: ## run unit tests with docker - docker-compose -p athensunit up --exit-code-from=testunit --build testunit + docker-compose -p athensunit build --build-arg GOLANG_VERSION=${GOLANG_VERSION} testunit + docker-compose -p athensunit up --exit-code-from=testunit testunit docker-compose -p athensunit down .PHONY: test-e2e @@ -56,7 +62,8 @@ test-e2e: .PHONY: test-e2e-docker test-e2e-docker: - docker-compose -p athense2e up --build --exit-code-from=teste2e teste2e + docker-compose -p athense2e build --build-arg GOLANG_VERSION=${GOLANG_VERSION} teste2e + docker-compose -p athense2e up --exit-code-from=teste2e teste2e docker-compose -p athense2e down .PHONY: docker diff --git a/docker-compose.yml b/docker-compose.yml index e42cdfa8..b389807f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,6 +17,8 @@ services: build: context: . dockerfile: Dockerfile.test + args: + GOLANG_VERSION: 1.12 command: ["./scripts/test_unit.sh"] environment: - GO_ENV=test @@ -31,6 +33,8 @@ services: build: context: . dockerfile: Dockerfile.test + args: + GOLANG_VERSION: 1.12 command: ["./scripts/test_e2e.sh"] azurite: image: arafato/azurite:2.6.5