From d33d0ef918781996972331f6bf597ee18533b9c0 Mon Sep 17 00:00:00 2001 From: Rohit Arora Date: Fri, 8 Mar 2024 10:36:18 -0500 Subject: [PATCH 1/2] Initial commit to update versions Signed-off-by: Rohit Arora --- Makefile | 30 ++++++++++++++++++++++++------ cmd/dcgm-exporter/main.go | 2 +- hack/VERSION | 4 ++++ 3 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 hack/VERSION diff --git a/Makefile b/Makefile index 5c119097..69433a43 100644 --- a/Makefile +++ b/Makefile @@ -12,12 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +include hack/VERSION + MKDIR ?= mkdir REGISTRY ?= nvidia -DCGM_VERSION := 3.3.5 +DCGM_VERSION := $(NEW_DCGM_VERSION) GOLANG_VERSION := 1.21.5 -VERSION := 3.4.0 +VERSION := $(NEW_EXPORTER_VERSION) FULL_VERSION := $(DCGM_VERSION)-$(VERSION) OUTPUT := type=oci,dest=/tmp/dcgm-exporter.tar PLATFORMS := linux/amd64,linux/arm64 @@ -25,9 +27,9 @@ DOCKERCMD := docker buildx build MODULE := github.com/NVIDIA/dcgm-exporter .PHONY: all binary install check-format local -all: ubuntu22.04 ubi9 +all: update-version ubuntu22.04 ubi9 -binary: +binary: update-version cd cmd/dcgm-exporter; go build -ldflags "-X main.BuildVersion=${DCGM_VERSION}-${VERSION}" test-main: @@ -42,7 +44,7 @@ check-format: test $$(gofmt -l pkg | tee /dev/stderr | wc -l) -eq 0 test $$(gofmt -l cmd | tee /dev/stderr | wc -l) -eq 0 -push: +push: update-version $(MAKE) ubuntu22.04 OUTPUT=type=registry $(MAKE) ubi9 OUTPUT=type=registry @@ -108,4 +110,20 @@ check-fmt: .PHONY: e2e-test e2e-test: - cd tests/e2e && make e2e-test \ No newline at end of file + cd tests/e2e && make e2e-test + +# Command for in-place substitution +SED_CMD := sed -i$(shell uname -s | grep -q Darwin && echo " ''") + +# Create list of paths to Go, YAML, README.md, and Makefile files +FILE_PATHS := $(shell find . -type f \( -name "*.go" -o -name "*.yaml" -o -name "README.md" -o -name "Makefile" \)) + +# Replace the old version with the new version in specified files +update-version: + @echo "Updating DCGM version in files from $(OLD_DCGM_VERSION) to $(NEW_DCGM_VERSION)..." + @$(foreach file,$(FILE_PATHS),$(SED_CMD) "s/$(OLD_DCGM_VERSION)/$(NEW_DCGM_VERSION)/g" $(file);) + @echo "Updating DCGM Exporter version in files from $(OLD_EXPORTER_VERSION) to $(NEW_EXPORTER_VERSION)..." + @$(foreach file,$(FILE_PATHS),$(SED_CMD) "s/$(OLD_EXPORTER_VERSION)/$(NEW_EXPORTER_VERSION)/g" $(file);) + +# Update DCGM and DCGM Exporter versions +update-versions: update-version diff --git a/cmd/dcgm-exporter/main.go b/cmd/dcgm-exporter/main.go index ad879b9d..9eebe6b6 100644 --- a/cmd/dcgm-exporter/main.go +++ b/cmd/dcgm-exporter/main.go @@ -25,7 +25,7 @@ import ( ) var ( - BuildVersion = "Filled by the build system" + BuildVersion = "3.3.5-3.4.0" ) func main() { diff --git a/hack/VERSION b/hack/VERSION new file mode 100644 index 00000000..72628af0 --- /dev/null +++ b/hack/VERSION @@ -0,0 +1,4 @@ +OLD_DCGM_VERSION=3.3.5 +OLD_EXPORTER_VERSION=3.4.0 +NEW_DCGM_VERSION=3.3.5 +NEW_EXPORTER_VERSION=3.4.0 From 0db691e56644f8ea54924cfa7178487ca26de124 Mon Sep 17 00:00:00 2001 From: Rohit Arora Date: Mon, 18 Mar 2024 12:44:22 -0400 Subject: [PATCH 2/2] Address review comments --- Makefile | 4 ++-- cmd/dcgm-exporter/main.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 69433a43..76873b03 100644 --- a/Makefile +++ b/Makefile @@ -115,8 +115,8 @@ e2e-test: # Command for in-place substitution SED_CMD := sed -i$(shell uname -s | grep -q Darwin && echo " ''") -# Create list of paths to Go, YAML, README.md, and Makefile files -FILE_PATHS := $(shell find . -type f \( -name "*.go" -o -name "*.yaml" -o -name "README.md" -o -name "Makefile" \)) +# Create list of paths to YAML, README.md, and Makefile files +FILE_PATHS := $(shell find . -type f \( -name "*.yaml" -o -name "README.md" -o -name "Makefile" \)) # Replace the old version with the new version in specified files update-version: diff --git a/cmd/dcgm-exporter/main.go b/cmd/dcgm-exporter/main.go index 9eebe6b6..ad879b9d 100644 --- a/cmd/dcgm-exporter/main.go +++ b/cmd/dcgm-exporter/main.go @@ -25,7 +25,7 @@ import ( ) var ( - BuildVersion = "3.3.5-3.4.0" + BuildVersion = "Filled by the build system" ) func main() {