Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile changes to update version information #286

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,24 @@
# 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
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:
Expand All @@ -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

Expand Down Expand Up @@ -108,4 +110,20 @@ check-fmt:

.PHONY: e2e-test
e2e-test:
cd tests/e2e && make e2e-test
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
rohit-arora-dev marked this conversation as resolved.
Show resolved Hide resolved
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
2 changes: 1 addition & 1 deletion cmd/dcgm-exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
)

var (
BuildVersion = "Filled by the build system"
rohit-arora-dev marked this conversation as resolved.
Show resolved Hide resolved
BuildVersion = "3.3.5-3.4.0"
)

func main() {
Expand Down
4 changes: 4 additions & 0 deletions hack/VERSION
Original file line number Diff line number Diff line change
@@ -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
Loading