Add basic multi-arch support to release tests

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2021-11-16 15:02:01 +01:00
parent 6731f050da
commit 094631329f

View File

@ -21,21 +21,23 @@ RUN_TARGETS := $(patsubst %,run-%, $(DISTRIBUTIONS))
RELEASE_TARGETS := $(patsubst %,release-%, $(DISTRIBUTIONS)) RELEASE_TARGETS := $(patsubst %,release-%, $(DISTRIBUTIONS))
LOCAL_TARGETS := $(patsubst %,local-%, $(DISTRIBUTIONS)) LOCAL_TARGETS := $(patsubst %,local-%, $(DISTRIBUTIONS))
.PHONY: $(IMAGE_TARGETS) .PHONY: $(IMAGE_TARGETS) $(RUN_TARGETS)
image-%: DOCKERFILE = docker/$(*)/Dockerfile image-%: DOCKERFILE = docker/$(*)/Dockerfile
images: $(IMAGE_TARGETS) images: $(IMAGE_TARGETS)
$(IMAGE_TARGETS): image-%: $(IMAGE_TARGETS): image-%: $(DOCKERFILE)
docker build \ docker build ${PLATFORM_ARGS} \
--build-arg WORKFLOW="$(WORKFLOW)" \ --build-arg WORKFLOW="$(WORKFLOW)" \
-t nvidia-container-toolkit-repo-test:$(*) \ -t nvidia-container-toolkit-repo-test:$(*) \
-f $(DOCKERFILE) \ -f $(DOCKERFILE) \
$(shell dirname $(DOCKERFILE)) $(shell dirname $(DOCKERFILE))
%-ubuntu18.04: ARCH = amd64 %-ubuntu18.04: ARCH ?= amd64
%-centos8: ARCH = x86_64 %-centos8: ARCH ?= x86_64
PLATFORM_ARGS = --platform=linux/${ARCH}
RELEASE_TEST_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) RELEASE_TEST_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
PROJECT_ROOT := $(RELEASE_TEST_DIR)/../.. PROJECT_ROOT := $(RELEASE_TEST_DIR)/../..
@ -47,8 +49,8 @@ local-%: LOCAL_REPO_ARGS = -v $(LOCAL_PACKAGE_ROOT)/$(DIST)/$(ARCH):/local-repos
$(LOCAL_TARGETS): local-%: release-% run-% | release-% $(LOCAL_TARGETS): local-%: release-% run-% | release-%
run-%: DIST = $(*) run-%: DIST = $(*)
$(RUN_TARGETS): run-%: $(RUN_TARGETS): run-%: image-%
docker run --rm -ti \ docker run ${PLATFORM_ARGS} --rm -ti \
$(LOCAL_REPO_ARGS) \ $(LOCAL_REPO_ARGS) \
nvidia-container-toolkit-repo-test:$(*) nvidia-container-toolkit-repo-test:$(*)