From 13d015cf93bfd91245965321ad681290bfabda9c Mon Sep 17 00:00:00 2001 From: Shireesh Anjal <355479+anjalshireesh@users.noreply.github.com> Date: Tue, 9 Feb 2021 22:59:43 +0530 Subject: [PATCH] Fix make target hotfix (#11492) The code inside the `hotfix` taget is overriding the values set at the beginning of the Makefile affecting other make targets as well. For example, running `TAG=mytag make docker` also ends up tagging the docker image as a hotfix instead of `mytag`. Using the `eval` function inside the `hotfix` target fixes this. --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4d3e276a4..dbc709322 100644 --- a/Makefile +++ b/Makefile @@ -71,10 +71,11 @@ build: checks @echo "Building minio binary to './minio'" @GO111MODULE=on CGO_ENABLED=0 go build -tags kqueue -trimpath --ldflags "$(LDFLAGS)" -o $(PWD)/minio 1>/dev/null -hotfix: LDFLAGS := $(shell MINIO_RELEASE="RELEASE" MINIO_HOTFIX="hotfix.$(shell git rev-parse --short HEAD)" go run buildscripts/gen-ldflags.go $(shell git describe --tags --abbrev=0 | \ - sed 's#RELEASE\.\([0-9]\+\)-\([0-9]\+\)-\([0-9]\+\)T\([0-9]\+\)-\([0-9]\+\)-\([0-9]\+\)Z#\1-\2-\3T\4:\5:\6Z#')) - TAG := "minio/minio:$(shell git describe --tags --abbrev=0).hotfix.$(shell git rev-parse --short HEAD)" -hotfix: install +hotfix-vars: + $(eval LDFLAGS := $(shell MINIO_RELEASE="RELEASE" MINIO_HOTFIX="hotfix.$(shell git rev-parse --short HEAD)" go run buildscripts/gen-ldflags.go $(shell git describe --tags --abbrev=0 | \ + sed 's#RELEASE\.\([0-9]\+\)-\([0-9]\+\)-\([0-9]\+\)T\([0-9]\+\)-\([0-9]\+\)-\([0-9]\+\)Z#\1-\2-\3T\4:\5:\6Z#'))) + $(eval TAG := "minio/minio:$(shell git describe --tags --abbrev=0).hotfix.$(shell git rev-parse --short HEAD)") +hotfix: hotfix-vars install docker-hotfix: hotfix checks @echo "Building minio docker image '$(TAG)'"