Skip to content

Commit

Permalink
The current mechanism to get the tag name doesn't work well.
Browse files Browse the repository at this point in the history
When a new commit lands to the master branch, the master branch is
not named correctly

i.e:
```
rsevilla@wonderland /tmp/foo (master) $ git describe --tags 2>/dev/null || git rev-parse --abbrev-ref HEAD | sed 's/master/latest/g'
v1.0.0-1-g487fada
rsevilla@wonderland /tmp/foo (master) $ git log --oneline | head
487fada Foo
12701a6 Added exit status for uperf failures (#782)
94005cd missing env var num_pairs (#784)
```

Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 committed Jul 12, 2022
1 parent 12701a6 commit 41eb251
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions hack/tag_name.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 41eb251

Please sign in to comment.