mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Merge pull request #1980 from marquiz/backports/0.16
[release-0.16] Fix version parsing
This commit is contained in:
commit
725c20496e
7 changed files with 9 additions and 9 deletions
2
Makefile
2
Makefile
|
@ -29,7 +29,7 @@ SITE_BASEURL ?=
|
||||||
SITE_DESTDIR ?= _site
|
SITE_DESTDIR ?= _site
|
||||||
JEKYLL_OPTS := -d '$(SITE_DESTDIR)' $(if $(SITE_BASEURL),-b '$(SITE_BASEURL)',)
|
JEKYLL_OPTS := -d '$(SITE_DESTDIR)' $(if $(SITE_BASEURL),-b '$(SITE_BASEURL)',)
|
||||||
|
|
||||||
VERSION := $(shell git describe --tags --dirty --always)
|
VERSION := $(shell git describe --tags --dirty --always --match "v*")
|
||||||
|
|
||||||
IMAGE_REGISTRY ?= registry.k8s.io/nfd
|
IMAGE_REGISTRY ?= registry.k8s.io/nfd
|
||||||
IMAGE_TAG_NAME ?= $(VERSION)
|
IMAGE_TAG_NAME ?= $(VERSION)
|
||||||
|
|
|
@ -47,7 +47,7 @@ func main() {
|
||||||
|
|
||||||
// Assert that the version is known
|
// Assert that the version is known
|
||||||
if version.Undefined() {
|
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
|
// Get new garbage collector instance
|
||||||
|
|
|
@ -102,7 +102,7 @@ func main() {
|
||||||
|
|
||||||
// Assert that the version is known
|
// Assert that the version is known
|
||||||
if version.Undefined() {
|
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
|
// Plug klog into grpc logging infrastructure
|
||||||
|
|
|
@ -49,7 +49,7 @@ func main() {
|
||||||
|
|
||||||
// Assert that the version is known
|
// Assert that the version is known
|
||||||
if version.Undefined() {
|
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
|
// Plug klog into grpc logging infrastructure
|
||||||
|
|
|
@ -56,7 +56,7 @@ func main() {
|
||||||
|
|
||||||
// Assert that the version is known
|
// Assert that the version is known
|
||||||
if version.Undefined() {
|
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.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check deprecated flags
|
// Check deprecated flags
|
||||||
|
|
|
@ -105,13 +105,13 @@ site_subdir=${site_subdir:-master}
|
||||||
|
|
||||||
# Check if this ref is for a released version
|
# Check if this ref is for a released version
|
||||||
if [ "$site_subdir" != "master" ]; then
|
if [ "$site_subdir" != "master" ]; then
|
||||||
_base_tag=`git describe --abbrev=0 || :`
|
_base_tag=`git describe --abbrev=0 --match "v*" || :`
|
||||||
case "$_base_tag" in
|
case "$_base_tag" in
|
||||||
$site_subdir*)
|
$site_subdir*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Not a released version. Parsed release branch is $site_subdir but based on tag $_base_tag. Stopping here."
|
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
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -130,7 +130,7 @@ make site-build
|
||||||
if [ -n "$_GIT_TAG" ]; then
|
if [ -n "$_GIT_TAG" ]; then
|
||||||
commit_hash=${GIT_TAG:10}
|
commit_hash=${GIT_TAG:10}
|
||||||
else
|
else
|
||||||
commit_hash=`git describe --tags --dirty --always`
|
commit_hash=`git describe --tags --dirty --always --match "v*"`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Sync OWNERS file from master branch
|
# Sync OWNERS file from master branch
|
||||||
|
|
|
@ -4,7 +4,7 @@ set -o pipefail
|
||||||
# Configure environment
|
# Configure environment
|
||||||
KIND_IMAGE="kindest/node:v1.25.3"
|
KIND_IMAGE="kindest/node:v1.25.3"
|
||||||
export IMAGE_REGISTRY="localhost:5001"
|
export IMAGE_REGISTRY="localhost:5001"
|
||||||
export CLUSTER_NAME=$(git describe --tags --dirty --always)
|
export CLUSTER_NAME=$(git describe --tags --dirty --always --match "v*")
|
||||||
export KUBECONFIG="/tmp/kubeconfig_$CLUSTER_NAME"
|
export KUBECONFIG="/tmp/kubeconfig_$CLUSTER_NAME"
|
||||||
|
|
||||||
# create registry container unless it already exists
|
# create registry container unless it already exists
|
||||||
|
|
Loading…
Reference in a new issue