Skip to content

Commit 725c204

Browse files
authored
Merge pull request #1980 from marquiz/backports/0.16
[release-0.16] Fix version parsing
2 parents e2dbd2c + f99c1dd commit 725c204

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ SITE_BASEURL ?=
2929
SITE_DESTDIR ?= _site
3030
JEKYLL_OPTS := -d '$(SITE_DESTDIR)' $(if $(SITE_BASEURL),-b '$(SITE_BASEURL)',)
3131

32-
VERSION := $(shell git describe --tags --dirty --always)
32+
VERSION := $(shell git describe --tags --dirty --always --match "v*")
3333

3434
IMAGE_REGISTRY ?= registry.k8s.io/nfd
3535
IMAGE_TAG_NAME ?= $(VERSION)

cmd/nfd-gc/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func main() {
4747

4848
// Assert that the version is known
4949
if version.Undefined() {
50-
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.")
50+
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.")
5151
}
5252

5353
// Get new garbage collector instance

cmd/nfd-master/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func main() {
102102

103103
// Assert that the version is known
104104
if version.Undefined() {
105-
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.")
105+
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.")
106106
}
107107

108108
// Plug klog into grpc logging infrastructure

cmd/nfd-topology-updater/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func main() {
4949

5050
// Assert that the version is known
5151
if version.Undefined() {
52-
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.")
52+
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.")
5353
}
5454

5555
// Plug klog into grpc logging infrastructure

cmd/nfd-worker/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func main() {
5656

5757
// Assert that the version is known
5858
if version.Undefined() {
59-
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.")
59+
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.")
6060
}
6161

6262
// Check deprecated flags

scripts/github/update-gh-pages.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ site_subdir=${site_subdir:-master}
105105

106106
# Check if this ref is for a released version
107107
if [ "$site_subdir" != "master" ]; then
108-
_base_tag=`git describe --abbrev=0 || :`
108+
_base_tag=`git describe --abbrev=0 --match "v*" || :`
109109
case "$_base_tag" in
110110
$site_subdir*)
111111
;;
112112
*)
113113
echo "Not a released version. Parsed release branch is $site_subdir but based on tag $_base_tag. Stopping here."
114-
echo "SHA `git describe` (`git rev-parse HEAD`)"
114+
echo "SHA `git describe` (`git rev-parse --match 'v*' HEAD`)"
115115
exit 0
116116
;;
117117
esac
@@ -130,7 +130,7 @@ make site-build
130130
if [ -n "$_GIT_TAG" ]; then
131131
commit_hash=${GIT_TAG:10}
132132
else
133-
commit_hash=`git describe --tags --dirty --always`
133+
commit_hash=`git describe --tags --dirty --always --match "v*"`
134134
fi
135135

136136
# Sync OWNERS file from master branch

scripts/test-infra/test-e2e-presubmit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -o pipefail
44
# Configure environment
55
KIND_IMAGE="kindest/node:v1.25.3"
66
export IMAGE_REGISTRY="localhost:5001"
7-
export CLUSTER_NAME=$(git describe --tags --dirty --always)
7+
export CLUSTER_NAME=$(git describe --tags --dirty --always --match "v*")
88
export KUBECONFIG="/tmp/kubeconfig_$CLUSTER_NAME"
99

1010
# create registry container unless it already exists

0 commit comments

Comments
 (0)