diff --git a/Makefile b/Makefile index ca4b52791..33341a3c0 100644 --- a/Makefile +++ b/Makefile @@ -41,8 +41,8 @@ ARCH ?= $(shell uname -m | sed 's/x86_64/amd64/') REGISTRY ?= quay.io ORG ?= cloud-bulldozer # Get the current branch name -# In case this is the master branch, rename it to latest -VERSION ?= $(shell git describe --tags 2>/dev/null || git rev-parse --abbrev-ref HEAD | sed 's/master/latest/g') +# In case is the master branch, rename it to latest +VERSION ?= $(shell hack/tag_name.sh) IMG ?= $(REGISTRY)/$(ORG)/benchmark-operator:$(VERSION) ifdef IMAGE_ARCH IMG := $(REGISTRY)/$(ORG)/benchmark-operator:$(VERSION)-$(IMAGE_ARCH) diff --git a/hack/tag_name.sh b/hack/tag_name.sh new file mode 100755 index 000000000..0ff164f41 --- /dev/null +++ b/hack/tag_name.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if [[ -z $(git branch --show-current) ]]; then + git describe --tags --abbrev=0 +else + git branch --show-current | sed 's/master/latest/g' +fi