From 047d0314aa91c7e81a87914789e75b97b330ed5e Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Thu, 12 Dec 2024 22:14:50 +0200 Subject: [PATCH] Fix version parsing The fix in a416af51a48d5d49cc0f17b069b3fc6e8566bedd was not enough by itself and that needs to be applied comprehensively. --- cmd/nfd-gc/main.go | 2 +- cmd/nfd-master/main.go | 2 +- cmd/nfd-topology-updater/main.go | 2 +- cmd/nfd-worker/main.go | 2 +- scripts/github/update-gh-pages.sh | 4 ++-- scripts/test-infra/test-e2e-presubmit.sh | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/nfd-gc/main.go b/cmd/nfd-gc/main.go index 6093ac761..799185514 100644 --- a/cmd/nfd-gc/main.go +++ b/cmd/nfd-gc/main.go @@ -47,7 +47,7 @@ func main() { // Assert that the version is known if version.Undefined() { - klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always`\" during build or run.") + klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always --match 'v*'`\" during build or run.") } // Get new garbage collector instance diff --git a/cmd/nfd-master/main.go b/cmd/nfd-master/main.go index bc702d0e7..397e80378 100644 --- a/cmd/nfd-master/main.go +++ b/cmd/nfd-master/main.go @@ -83,7 +83,7 @@ func main() { // Assert that the version is known if version.Undefined() { - klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always`\" during build or run.") + klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always --match 'v*'`\" during build or run.") } // Plug klog into grpc logging infrastructure diff --git a/cmd/nfd-topology-updater/main.go b/cmd/nfd-topology-updater/main.go index dc6bee50d..89fe8c57e 100644 --- a/cmd/nfd-topology-updater/main.go +++ b/cmd/nfd-topology-updater/main.go @@ -49,7 +49,7 @@ func main() { // Assert that the version is known if version.Undefined() { - klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always`\" during build or run.") + klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always --match 'v*'`\" during build or run.") } // Plug klog into grpc logging infrastructure diff --git a/cmd/nfd-worker/main.go b/cmd/nfd-worker/main.go index fe589f546..8a86ba929 100644 --- a/cmd/nfd-worker/main.go +++ b/cmd/nfd-worker/main.go @@ -56,7 +56,7 @@ func main() { // Assert that the version is known if version.Undefined() { - klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always`\" during build or run.") + klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always --match 'v*'`\" during build or run.") } // Plug klog into grpc logging infrastructure diff --git a/scripts/github/update-gh-pages.sh b/scripts/github/update-gh-pages.sh index e6edd19fb..f3e3ba553 100755 --- a/scripts/github/update-gh-pages.sh +++ b/scripts/github/update-gh-pages.sh @@ -111,7 +111,7 @@ if [ "$site_subdir" != "master" ]; then ;; *) echo "Not a released version. Parsed release branch is $site_subdir but based on tag $_base_tag. Stopping here." - echo "SHA `git describe` (`git rev-parse HEAD`)" + echo "SHA `git describe` (`git rev-parse --match 'v*' HEAD`)" exit 0 ;; esac @@ -130,7 +130,7 @@ make site-build if [ -n "$_GIT_TAG" ]; then commit_hash=${GIT_TAG:10} else - commit_hash=`git describe --tags --dirty --always` + commit_hash=`git describe --tags --dirty --always --match "v*"` fi # Sync OWNERS file from master branch diff --git a/scripts/test-infra/test-e2e-presubmit.sh b/scripts/test-infra/test-e2e-presubmit.sh index 5f9f3583e..a50c01b30 100755 --- a/scripts/test-infra/test-e2e-presubmit.sh +++ b/scripts/test-infra/test-e2e-presubmit.sh @@ -7,7 +7,7 @@ export KIND_NODE_IMAGE="kindest/node:v1.30.2" export CLUSTER_NAME="nfd-e2e" export KUBECONFIG="/tmp/kubeconfig_$CLUSTER_NAME" export IMAGE_REPO="registry.local/node-feature-discovery" -export IMAGE_TAG_NAME=$(git describe --tags --dirty --always) +export IMAGE_TAG_NAME=$(git describe --tags --dirty --always --match "v*") # Install kind go install sigs.k8s.io/kind@$KIND_VERSION