From d2da805e8f1ed2e57c7ee2c80791b8425f372403 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Sun, 28 Jan 2024 12:28:28 +0100 Subject: [PATCH] Use k8s-test-infra devel image Signed-off-by: Evan Lezar --- Makefile | 32 ++++++-------------------------- docker/Dockerfile.devel | 24 ------------------------ versions.mk | 5 ++++- 3 files changed, 10 insertions(+), 51 deletions(-) delete mode 100644 docker/Dockerfile.devel diff --git a/Makefile b/Makefile index 8d55c579..79beea90 100644 --- a/Makefile +++ b/Makefile @@ -21,9 +21,6 @@ REGISTRY ?= nvidia IMAGE_NAME=$(REGISTRY)/mig-parted endif -BUILDIMAGE_TAG ?= golang$(GOLANG_VERSION) -BUILDIMAGE ?= $(IMAGE_NAME)-build:$(BUILDIMAGE_TAG) - EXAMPLES := $(patsubst ./examples/%/,%,$(sort $(dir $(wildcard ./examples/*/)))) EXAMPLE_TARGETS := $(patsubst %,example-%,$(EXAMPLES)) @@ -106,30 +103,12 @@ coverage: test cat $(COVERAGE_FILE) | grep -v "_mock.go" > $(COVERAGE_FILE).no-mocks go tool cover -func=$(COVERAGE_FILE).no-mocks -# Generate an image for containerized builds -# Note: This image is local only -.PHONY: .build-image .pull-build-image .push-build-image -.build-image: docker/Dockerfile.devel - if [ x"$(SKIP_IMAGE_BUILD)" = x"" ]; then \ - $(DOCKER) build \ - --progress=plain \ - --build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \ - --tag $(BUILDIMAGE) \ - -f $(^) \ - docker; \ - fi - -.pull-build-image: - $(DOCKER) pull $(BUILDIMAGE) - -.push-build-image: - $(DOCKER) push $(BUILDIMAGE) - -$(DOCKER_TARGETS): docker-%: .build-image - @echo "Running 'make $(*)' in docker container $(BUILDIMAGE)" +$(DOCKER_TARGETS): docker-%: + @echo "Running 'make $(*)' in container image $(BUILDIMAGE)" $(DOCKER) run \ --rm \ - -e GOCACHE=/tmp/.cache \ + -e GOCACHE=/tmp/.cache/go \ + -e GOMODCACHE=/tmp/.cache/gomod \ -v $(PWD):/work \ -w /work \ --user $$(id -u):$$(id -g) \ @@ -142,7 +121,8 @@ PHONY: .shell $(DOCKER) run \ --rm \ -ti \ - -e GOCACHE=/tmp/.cache \ + -e GOCACHE=/tmp/.cache/go \ + -e GOMODCACHE=/tmp/.cache/gomod \ -v $(PWD):/work \ -w /work \ --user $$(id -u):$$(id -g) \ diff --git a/docker/Dockerfile.devel b/docker/Dockerfile.devel deleted file mode 100644 index f1bc01dc..00000000 --- a/docker/Dockerfile.devel +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -ARG GOLANG_VERSION=1.20.4 -FROM golang:${GOLANG_VERSION} - -RUN go install golang.org/x/lint/golint@6edffad5e6160f5949cdefc81710b2706fbcd4f6 -RUN go install github.com/matryer/moq@latest -RUN go install github.com/gordonklaus/ineffassign@d2c82e48359b033cde9cf1307f6d5550b8d61321 -RUN go install github.com/client9/misspell/cmd/misspell@latest - -# We need to set the /work directory as a safe directory. -# This allows git commands to run in the container. -RUN git config --file=/.gitconfig --add safe.directory /work diff --git a/versions.mk b/versions.mk index 59fe9aa1..81bb8ae9 100644 --- a/versions.mk +++ b/versions.mk @@ -20,6 +20,9 @@ vVERSION := v$(VERSION:v%=%) CUDA_VERSION := 12.2.2 GOLANG_VERSION := 1.20.4 -NVIDIA_CTK_VERSION := v1.13.4 +BUILDIMAGE_TAG ?= devel-go$(GOLANG_VERSION) +BUILDIMAGE ?= ghcr.io/nvidia/k8s-test-infra:$(BUILDIMAGE_TAG) GIT_COMMIT ?= $(shell git describe --match="" --dirty --long --always --abbrev=40 2> /dev/null || echo "") + +NVIDIA_CTK_VERSION := v1.13.4