From ee226f806547e86aea3a0bbaee7fbde35be7da76 Mon Sep 17 00:00:00 2001 From: Marco Pracucci Date: Tue, 22 Feb 2022 11:20:50 +0100 Subject: [PATCH] Strip 'mimir-' prefix from git tag when building image tag (#1261) * Strip 'mimir-' prefix from git tag when building image tag Signed-off-by: Marco Pracucci * Fix Signed-off-by: Marco Pracucci * Applying Arve fix Signed-off-by: Marco Pracucci * Another fix Signed-off-by: Marco Pracucci --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b372eb2cb43..c5257bd3a46 100644 --- a/Makefile +++ b/Makefile @@ -38,8 +38,11 @@ BUILD_IMAGE ?= $(IMAGE_PREFIX)mimir-build-image # the tag we are at as the image tag. ifneq (,$(findstring refs/tags/, $(GITHUB_REF))) GIT_TAG := $(shell git tag --points-at HEAD) + # If the git tag starts with "mimir-" (eg. "mimir-2.0.0") we strip + # the "mimir-" prefix in order to keep only the version. + IMAGE_TAG_FROM_GIT_TAG := $(patsubst mimir-%,%,$(GIT_TAG)) endif -IMAGE_TAG ?= $(if $(GIT_TAG),$(GIT_TAG),$(shell ./tools/image-tag)) +IMAGE_TAG ?= $(if $(IMAGE_TAG_FROM_GIT_TAG),$(IMAGE_TAG_FROM_GIT_TAG),$(shell ./tools/image-tag)) GIT_REVISION := $(shell git rev-parse --short HEAD) GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) UPTODATE := .uptodate