Skip to content

Commit 99a8916

Browse files
committed
Leverage dependabot to update go version and update the devel image
Signed-off-by: Christopher Desiniotis <cdesiniotis@nvidia.com>
1 parent e878c6e commit 99a8916

File tree

6 files changed

+51
-26
lines changed

6 files changed

+51
-26
lines changed

.github/dependabot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ updates:
2424
interval: "daily"
2525

2626
- package-ecosystem: "docker"
27-
directory: "/deployments/container"
27+
directories:
28+
- "/deployments/container"
29+
- "/deployments/devel"
2830
schedule:
2931
interval: "daily"

.github/workflows/golang.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
- name: Get Golang version
3434
id: vars
3535
run: |
36-
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
37-
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
36+
GOLANG_VERSION=$(./hack/golang-version.sh)
37+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV
3838
- name: Install Go
3939
uses: actions/setup-go@v5
4040
with:
@@ -54,8 +54,8 @@ jobs:
5454
- name: Get Golang version
5555
id: vars
5656
run: |
57-
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
58-
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
57+
GOLANG_VERSION=$(./hack/golang-version.sh)
58+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV
5959
- name: Install Go
6060
uses: actions/setup-go@v5
6161
with:
@@ -69,8 +69,8 @@ jobs:
6969
- name: Get Golang version
7070
id: vars
7171
run: |
72-
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
73-
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
72+
GOLANG_VERSION=$(./hack/golang-version.sh)
73+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV
7474
- name: Install Go
7575
uses: actions/setup-go@v5
7676
with:

Makefile

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ DOCKER ?= docker
1919
include $(CURDIR)/versions.mk
2020

2121
BUILDIMAGE_TAG ?= golang$(GOLANG_VERSION)
22-
BUILDIMAGE ?= vgpu-device-manager-build
22+
BUILDIMAGE ?= vgpu-device-manager-build:$(BUILDIMAGE_TAG)
2323

2424
CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/))))
2525
CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS))
2626

2727
CHECK_TARGETS := assert-fmt vet lint ineffassign misspell
28-
MAKE_TARGETS := binaries build check fmt lint-internal test examples cmds coverage generate $(CHECK_TARGETS)
28+
MAKE_TARGETS := binaries build check fmt lint-internal test examples cmds coverage generate $(CHECK_TARGETS) $(CMD_TARGETS)
2929

3030
TARGETS := $(MAKE_TARGETS)
3131

@@ -75,31 +75,27 @@ coverage: test
7575
cat $(COVERAGE_FILE) | grep -v "_mock.go" > $(COVERAGE_FILE).no-mocks
7676
go tool cover -func=$(COVERAGE_FILE).no-mocks
7777

78-
79-
.PHONY: .build-image .pull-build-image .push-build-image
80-
.build-image: docker/Dockerfile.devel
78+
# Generate an image for containerized builds
79+
# Note: This image is local only
80+
.PHONY: .build-image
81+
.build-image: deployments/devel/Dockerfile
8182
if [ x"$(SKIP_IMAGE_BUILD)" = x"" ]; then \
8283
$(DOCKER) build \
8384
--progress=plain \
84-
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
8585
--tag $(BUILDIMAGE) \
8686
-f $(^) \
87-
docker; \
87+
deployments/devel; \
8888
fi
8989

90-
.pull-build-image:
91-
$(DOCKER) pull $(BUILDIMAGE)
92-
93-
.push-build-image:
94-
$(DOCKER) push $(BUILDIMAGE)
95-
9690
$(DOCKER_TARGETS): docker-%: .build-image
9791
@echo "Running 'make $(*)' in docker container $(BUILDIMAGE)"
9892
$(DOCKER) run \
9993
--rm \
100-
-e GOCACHE=/tmp/.cache \
101-
-v $(PWD):$(PWD) \
102-
-w $(PWD) \
94+
-e GOCACHE=/tmp/.cache/go \
95+
-e GOMODCACHE=/tmp/.cache/gomod \
96+
-e GOLANGCI_LINT_CACHE=/tmp/.cache/golangci-lint \
97+
-v $(PWD):/work \
98+
-w /work \
10399
--user $$(id -u):$$(id -g) \
104100
$(BUILDIMAGE) \
105101
make $(*)
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
ARG GOLANG_VERSION
15-
FROM golang:${GOLANG_VERSION}
14+
FROM golang:1.24.1
15+
16+
WORKDIR /work
1617

1718
RUN go install golang.org/x/lint/golint@latest
1819
RUN go install github.com/matryer/moq@latest
1920
RUN go install github.com/gordonklaus/ineffassign@latest
2021
RUN go install github.com/client9/misspell/cmd/misspell@latest
22+
23+
# We need to set the /work directory as a safe directory.
24+
# This allows git commands to run in the container.
25+
RUN git config --file=/.gitconfig --add safe.directory /work

hack/golang-version.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# Copyright 2025 NVIDIA CORPORATION
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../hack && pwd )"
17+
18+
DOCKERFILE_ROOT=${SCRIPTS_DIR}/../deployments/devel
19+
20+
GOLANG_VERSION=$(grep -E "^FROM golang:.*$" ${DOCKERFILE_ROOT}/Dockerfile | grep -oE "[0-9\.]+")
21+
22+
echo $GOLANG_VERSION

versions.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ VERSION ?= v0.3.0
1616

1717
vVERSION := v$(VERSION:v%=%)
1818

19-
GOLANG_VERSION ?= 1.24.1
19+
GOLANG_VERSION := $(shell ./hack/golang-version.sh)
2020

2121
GIT_COMMIT ?= $(shell git describe --match="" --dirty --long --always --abbrev=40 2> /dev/null || echo "")

0 commit comments

Comments
 (0)