From ae97c827d65ef3416d7e6305e8d2d68f1ce93de5 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Thu, 28 Mar 2024 14:17:05 +0200 Subject: [PATCH] Always use --tags arg for git describe Consistently use --tags for git describe everywhere so that version numbering matches when unannotated tags are present. Signed-off-by: Markus Lehtonen --- .github/workflows/package-helm.yaml | 2 +- Makefile | 2 +- deployment/operator/Makefile | 2 +- scripts/build/update-gh-pages.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/package-helm.yaml b/.github/workflows/package-helm.yaml index df9d044e6..82b955982 100644 --- a/.github/workflows/package-helm.yaml +++ b/.github/workflows/package-helm.yaml @@ -70,7 +70,7 @@ jobs: # For unstable chart verison we use: # - chart version: x.y-unstable derived from the latest tag x.y.z # - image version: 'unstable'. - majmin="$(git describe | sed -E 's/(v[0-9]*\.[0-9]*).*$/\1/')" + majmin="$(git describe --tags | sed -E 's/(v[0-9]*\.[0-9]*).*$/\1/')" CHART_VERSION="${majmin}-unstable" if [ $GITHUB_REF_NAME = "main" ]; then APP_VERSION=unstable diff --git a/Makefile b/Makefile index b4ff98ed9..881c10f6b 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ SHELL := /bin/bash # Kubernetes version we pull in as modules and our external API versions. KUBERNETES_VERSION := $(shell grep 'k8s.io/kubernetes ' go.mod | sed 's/^.* //') -IMAGE_VERSION ?= $(shell git describe --dirty 2> /dev/null || echo v0.0.0-unknown) +IMAGE_VERSION ?= $(shell git describe --tags --dirty 2> /dev/null || echo v0.0.0-unknown) ifdef IMAGE_REPO override IMAGE_REPO := $(IMAGE_REPO)/ endif diff --git a/deployment/operator/Makefile b/deployment/operator/Makefile index 9b2269228..21070e8bb 100644 --- a/deployment/operator/Makefile +++ b/deployment/operator/Makefile @@ -1,7 +1,7 @@ SHELL := /bin/bash # Default image version (tag) and image save path. -IMAGE_VERSION ?= $(shell git describe --dirty 2> /dev/null) +IMAGE_VERSION ?= $(shell git describe --tags --dirty 2> /dev/null) IMAGE_PATH ?= . # CHANNELS define the bundle channels used in the bundle. diff --git a/scripts/build/update-gh-pages.sh b/scripts/build/update-gh-pages.sh index 7324412e2..db5f55f9e 100755 --- a/scripts/build/update-gh-pages.sh +++ b/scripts/build/update-gh-pages.sh @@ -139,7 +139,7 @@ fi # # Update gh-pages branch # -commit_hash=`git describe --dirty --always` +commit_hash=`git describe --tags --dirty --always` # Switch to work in the gh-pages worktree pushd "$build_dir"