diff --git a/Makefile b/Makefile index e792beb3..a9fc1ffe 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,7 @@ CLI_VERSION = $(LIB_VERSION)$(if $(LIB_TAG),-$(LIB_TAG)) else CLI_VERSION = $(VERSION) endif +CLI_VERSION_PACKAGE = github.com/NVIDIA/nvidia-container-toolkit/internal/info GOOS ?= linux @@ -60,7 +61,7 @@ cmd-%: COMMAND_BUILD_OPTIONS = -o $(PREFIX)/$(*) endif cmds: $(CMD_TARGETS) $(CMD_TARGETS): cmd-%: - GOOS=$(GOOS) go build -ldflags "-s -w -X github.com/NVIDIA/nvidia-container-toolkit/internal/info.gitCommit=$(GIT_COMMIT) -X github.com/NVIDIA/nvidia-container-toolkit/internal/info.version=$(CLI_VERSION)" $(COMMAND_BUILD_OPTIONS) $(MODULE)/cmd/$(*) + GOOS=$(GOOS) go build -ldflags "-s -w -X $(CLI_VERSION_PACKAGE).gitCommit=$(GIT_COMMIT) -X $(CLI_VERSION_PACKAGE).version=$(CLI_VERSION)" $(COMMAND_BUILD_OPTIONS) $(MODULE)/cmd/$(*) build: GOOS=$(GOOS) go build ./... diff --git a/versions.mk b/versions.mk index b993813b..ca5753b5 100644 --- a/versions.mk +++ b/versions.mk @@ -27,4 +27,4 @@ LIBNVIDIA_CONTAINER0_VERSION := 0.10.0+jetpack CUDA_VERSION := 11.7.1 GOLANG_VERSION := 1.17.8 -GIT_COMMIT ?= $(shell git describe --dirty --long --always 2> /dev/null || echo "") +GIT_COMMIT ?= $(shell git describe --match="" --dirty --long --always 2> /dev/null || echo "")