From 4715468f3a4ab1f26a9439ac4751420b42576b52 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 25 Feb 2020 18:38:47 +0300 Subject: [PATCH] add grpc version to image, add command to build gw with multiple grpc versions --- Makefile | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5721fe1..0adca33 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')" +GRPC_VERSION=$(shell go list -m google.golang.org/grpc | cut -d " " -f 2) + HUB_IMAGE=nspccdev/neofs B=\033[0;1m @@ -8,7 +10,7 @@ R=\033[0m # Show current version version: - @echo $(VERSION) + @echo $(VERSION)-$(GRPC_VERSION) # Make sure that all files added to commit deps: @@ -19,9 +21,30 @@ deps: @printf "${B}${G}⇒ Store vendor localy${R}: " @go mod vendor && echo OK || (echo fail && exit 2) +image: GRPC_VERSION?= image: deps - @echo "${B}${G}⇒ Build GW docker-image ${R}" + @echo "${B}${G}⇒ Build GW docker-image with $(GRPC_VERSION) ${R}" @docker build \ - --build-arg VERSION=$(VERSION) \ + --build-arg VERSION=$(VERSION)-$(GRPC_VERSION) \ -f Dockerfile \ - -t $(HUB_IMAGE)-http-gate:$(VERSION) . + -t $(HUB_IMAGE)-http-gate:$(VERSION)-$(GRPC_VERSION) . + +.PHONY: dev + +# v1.24.0 v1.25.1 v1.26.0 v1.27.1 +dev: VERSIONS?=$(GRPC_VERSION) +dev: + @echo "=> Build multiple images for $(VERSIONS)"; \ + for v in $(VERSIONS); do \ + curdir=$$(pwd); \ + echo "=> Checkout gRPC to $${v}"; \ + cd ../grpc-go; \ + git checkout $${v} &> /dev/null || (echo "Release $${v} not found" && exit 2); \ + cd ../neofs-api; \ + git checkout go.{sum,mod}; \ + go get google.golang.org/grpc@$${v}; \ + cd $${curdir}; \ + git checkout go.{sum,mod}; \ + go get google.golang.org/grpc@$${v}; \ + make image GRPC_VERSION=$${v}; \ + done \ No newline at end of file