Skip to content

Commit 2615b47

Browse files
authored
Merge branch 'main' into main
2 parents a67b164 + b6c7aae commit 2615b47

File tree

7 files changed

+26
-65
lines changed

7 files changed

+26
-65
lines changed

.github/dependabot.yml

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ updates:
99
schedule:
1010
interval: "weekly"
1111
day: "sunday"
12-
labels:
13-
- area/dependency
1412
ignore:
1513
- dependency-name: k8s.io/*
1614
labels:

.github/workflows/golang-build.yaml .github/workflows/golang.yaml

+11-6
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,21 @@ jobs:
3636
version: latest
3737
args: -v --timeout 5m
3838
skip-cache: true
39+
test:
40+
name: Unit test
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
- name: Install Go
46+
uses: actions/setup-go@v5
47+
with:
48+
go-version: '1.20'
49+
- run: make test
3950
build:
4051
runs-on: ubuntu-latest
4152
steps:
4253
- uses: actions/checkout@v4
4354

44-
- name: Build dev image
45-
run: make .build-image
46-
4755
- name: Build
4856
run: make docker-build
49-
50-
- name: Tests
51-
run: make docker-coverage

.github/workflows/build-images.yaml .github/workflows/images.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,3 @@ jobs:
7474
run: |
7575
echo "${VERSION}"
7676
make -f deployments/container/Makefile build-${{ matrix.dist }}
77-

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/nvidia-dra-plugin
66
.idea
77
[._]*.sw[a-p]
8+
coverage.out

Makefile

+11-35
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ ifeq ($(IMAGE_NAME),)
2626
IMAGE_NAME = $(REGISTRY)/$(DRIVER_NAME)
2727
endif
2828

29-
BUILDIMAGE_TAG ?= golang$(GOLANG_VERSION)
30-
BUILDIMAGE ?= $(IMAGE_NAME)-build:$(BUILDIMAGE_TAG)
31-
3229
CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/))))
3330
CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS))
3431

@@ -89,7 +86,7 @@ golangci-lint:
8986

9087
COVERAGE_FILE := coverage.out
9188
test: build cmds
92-
go test -v -coverprofile=$(COVERAGE_FILE) $(MODULE)/...
89+
go test -race -cover -v -coverprofile=$(COVERAGE_FILE) $(MODULE)/...
9390

9491
coverage: test
9592
cat $(COVERAGE_FILE) | grep -v "_mock.go" > $(COVERAGE_FILE).no-mocks
@@ -138,34 +135,14 @@ generate-clientset: .remove-clientset .remove-deepcopy .remove-crds
138135
.remove-clientset:
139136
rm -rf $(CURDIR)/$(PKG_BASE)/clientset
140137

141-
# Generate an image for containerized builds
142-
# Note: This image is local only
143-
.PHONY: .build-image .pull-build-image .push-build-image
144-
.build-image: docker/Dockerfile.devel
145-
if [ x"$(SKIP_IMAGE_BUILD)" = x"" ]; then \
146-
$(DOCKER) build \
147-
--progress=plain \
148-
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
149-
--tag $(BUILDIMAGE) \
150-
-f $(^) \
151-
docker; \
152-
fi
153-
154-
.pull-build-image:
155-
$(DOCKER) pull $(BUILDIMAGE)
156-
157-
.push-build-image:
158-
$(DOCKER) push $(BUILDIMAGE)
159-
160-
$(DOCKER_TARGETS): docker-%: .build-image
161-
@echo "Running 'make $(*)' in docker container $(BUILDIMAGE)"
138+
$(DOCKER_TARGETS): docker-%:
139+
@echo "Running 'make $(*)' in container image $(BUILDIMAGE)"
162140
$(DOCKER) run \
163141
--rm \
164-
-e HOME=$(PWD) \
165-
-e GOCACHE=$(PWD)/.cache/go \
166-
-e GOPATH=$(PWD)/.cache/gopath \
167-
-v $(PWD):$(PWD) \
168-
-w $(PWD) \
142+
-e GOCACHE=/tmp/.cache/go \
143+
-e GOMODCACHE=/tmp/.cache/gomod \
144+
-v $(PWD):/work \
145+
-w /work \
169146
--user $$(id -u):$$(id -g) \
170147
$(BUILDIMAGE) \
171148
make $(*)
@@ -176,10 +153,9 @@ PHONY: .shell
176153
$(DOCKER) run \
177154
--rm \
178155
-ti \
179-
-e HOME=$(PWD) \
180-
-e GOCACHE=$(PWD)/.cache/go \
181-
-e GOPATH=$(PWD)/.cache/gopath \
182-
-v $(PWD):$(PWD) \
183-
-w $(PWD) \
156+
-e GOCACHE=/tmp/.cache/go \
157+
-e GOMODCACHE=/tmp/.cache/gomod \
158+
-v $(PWD):/work \
159+
-w /work \
184160
--user $$(id -u):$$(id -g) \
185161
$(BUILDIMAGE)

docker/Dockerfile.devel

-21
This file was deleted.

versions.mk

+3
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ vVERSION := v$(VERSION:v%=%)
2424
GOLANG_VERSION ?= 1.20.4
2525
CUDA_VERSION ?= 11.8.0
2626

27+
BUILDIMAGE_TAG ?= devel-go$(GOLANG_VERSION)
28+
BUILDIMAGE ?= ghcr.io/nvidia/k8s-test-infra:$(BUILDIMAGE_TAG)
29+
2730
GIT_COMMIT ?= $(shell git describe --match="" --dirty --long --always --abbrev=40 2> /dev/null || echo "")

0 commit comments

Comments
 (0)