[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 20/24] tests/docker: use direct RUNC call to build containers
From: |
Alex Bennée |
Subject: |
[PULL v2 20/24] tests/docker: use direct RUNC call to build containers |
Date: |
Wed, 1 Mar 2023 15:16:00 +0000 |
We don't really need stuff from docker.py to do the build as we have
everything we need with a direct call. We do rely on the dockerfiles
being able to tweak the UID/name mapping as the last step.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230228190653.1602033-21-alex.bennee@linaro.org>
diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index bfb0dcac21..680afff952 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -7,6 +7,8 @@ SPACE := $(NULL) #
COMMA := ,
HOST_ARCH = $(if $(ARCH),$(ARCH),$(shell uname -m))
+USER = $(if $(NOUSER),,$(shell id -un))
+UID = $(if $(NOUSER),,$(shell id -u))
DOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles
ifeq ($(HOST_ARCH),x86_64)
@@ -14,6 +16,7 @@ DOCKER_DEFAULT_REGISTRY :=
registry.gitlab.com/qemu-project/qemu
endif
DOCKER_REGISTRY := $(if $(REGISTRY),$(REGISTRY),$(DOCKER_DEFAULT_REGISTRY))
+RUNC ?= docker
ENGINE ?= auto
DOCKER_SCRIPT=$(SRC_PATH)/tests/docker/docker.py --engine $(ENGINE)
@@ -35,15 +38,17 @@ docker-qemu-src: $(DOCKER_SRC_COPY)
# General rule for building docker images.
docker-image-%: $(DOCKER_FILES_DIR)/%.docker
- $(call quiet-command,\
- $(DOCKER_SCRIPT) build -t qemu/$* -f $< \
- $(if $V,,--quiet) \
- $(if $(NOCACHE),--no-cache, \
- $(if $(DOCKER_REGISTRY),--registry $(DOCKER_REGISTRY)))
\
- $(if $(NOUSER),,--add-current-user) \
- $(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES))\
- $(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\
- "BUILD","$*")
+ $(call quiet-command, \
+ $(RUNC) build \
+ $(if $V,,--quiet) \
+ $(if $(NOCACHE),--no-cache, \
+ $(if $(DOCKER_REGISTRY),--cache-from
$(DOCKER_REGISTRY)/qemu/$*)) \
+ --build-arg BUILDKIT_INLINE_CACHE=1 \
+ $(if $(NOUSER),, \
+ --build-arg USER=$(USER) \
+ --build-arg UID=$(UID)) \
+ -t qemu/$* - < $<, \
+ "BUILD", $1)
# Special rule for debootstraped binfmt linux-user images
docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker
--
2.39.2
- [PULL v2 06/24] gitlab: extend custom runners with base_job_template, (continued)
- [PULL v2 06/24] gitlab: extend custom runners with base_job_template, Alex Bennée, 2023/03/01
- [PULL v2 08/24] testing: update ubuntu2004 to ubuntu2204, Alex Bennée, 2023/03/01
- [PULL v2 10/24] tests: add tuxrun baseline test to avocado, Alex Bennée, 2023/03/01
- [PULL v2 07/24] tests: don't run benchmarks for the tsan build, Alex Bennée, 2023/03/01
- [PULL v2 15/24] gitlab: Use plain docker in container-template.yml, Alex Bennée, 2023/03/01
- [PULL v2 01/24] tests: don't run socat tests on MacOS as well, Alex Bennée, 2023/03/01
- [PULL v2 03/24] tests: be a bit more strict cleaning up fifos, Alex Bennée, 2023/03/01
- [PULL v2 11/24] tests/docker: Use binaries for debian-tricore-cross, Alex Bennée, 2023/03/01
- [PULL v2 18/24] tests/lcitool: append user setting stanza to dockerfiles, Alex Bennée, 2023/03/01
- [PULL v2 14/24] tests/dockerfiles: unify debian-toolchain references, Alex Bennée, 2023/03/01
- [PULL v2 20/24] tests/docker: use direct RUNC call to build containers,
Alex Bennée <=
- [PULL v2 19/24] tests/docker: add USER stanzas to non-lci images, Alex Bennée, 2023/03/01
- [PULL v2 24/24] tests/avocado: disable BootLinuxPPC64 test in CI, Alex Bennée, 2023/03/01
- [PULL v2 23/24] tests/docker: add zstdtools to the images, Alex Bennée, 2023/03/01
- [PULL v2 13/24] cirrus.yml: Improve the windows_msys2_task, Alex Bennée, 2023/03/01
- [PULL v2 17/24] configure: expose the direct container command, Alex Bennée, 2023/03/01
- [PULL v2 16/24] tests: Ensure TAP version is printed before other messages, Alex Bennée, 2023/03/01
- [PULL v2 12/24] tests: ensure we export job results for some cross builds, Alex Bennée, 2023/03/01
- [PULL v2 22/24] gitlab: move the majority of artefact handling to a template, Alex Bennée, 2023/03/01
- [PULL v2 21/24] tests/docker: use direct RUNC call to run test jobs, Alex Bennée, 2023/03/01
- Re: [PULL v2 00/24] testing updates (gitlab, cirrus, docker, avocado, windows), Peter Maydell, 2023/03/01