All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org, "Brad Smith" <brad@comstyle.com>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Song Gao" <gaosong@loongson.cn>, "Warner Losh" <imp@bsdimp.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Fabiano Rosas" <farosas@suse.de>, "John Snow" <jsnow@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@mailo.com>,
	"Thomas Huth" <th.huth+qemu@posteo.eu>,
	"Brian Cain" <brian.cain@oss.qualcomm.com>,
	qemu-arm@nongnu.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Kyle Evans" <kevans@freebsd.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Cleber Rosa" <crosa@redhat.com>
Subject: Re: [PATCH 5/9] tests/docker: add container registry to configure and use
Date: Tue, 15 Sep 2026 10:49:46 -0700	[thread overview]
Message-ID: <700467b2-f9a9-4192-aaeb-bcd3dd0dc6b7@oss.qualcomm.com> (raw)
In-Reply-To: <87zexia19c.fsf@draig.linaro.org>

On 9/15/2026 10:10 AM, Alex Bennée wrote:
> Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> writes:
> 
>> On 9/14/2026 12:28 AM, Alex Bennée wrote:
>>> Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> writes:
>>>
>>>> On 9/10/26 11:15 AM, Alex Bennée wrote:
>>>>> Previously we had the default baked into Makefile.include but as the
>>>>> meson container logic will also benefit from it we update the configure
>>>>> machinery.
>>>>> For now we allow direct make invocations to override but for the
>>>>> normal case it is in one place now.
>>>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>>>> ---
>>>>>   configure                     | 8 ++++++++
>>>>>   meson_options.txt             | 3 +++
>>>>>   tests/docker/Makefile.include | 4 +---
>>>>>   tests/tcg/meson.build         | 6 ++++++
>>>>>   4 files changed, 18 insertions(+), 3 deletions(-)
>>>>> diff --git a/configure b/configure
>>>>> index aaa41fe47aa..7d6b11ddd35 100755
>>>>> --- a/configure
>>>>> +++ b/configure
>>>>> @@ -172,6 +172,7 @@ fi
>>>>>   # some defaults, based on the host environment
>>>>>     # default parameters
>>>>> +container_registry="registry.gitlab.com/qemu-project/qemu"
>>>>>   cpu=""
>>>>>   cross_compile="no"
>>>>>   cross_prefix=""
>>>>> @@ -728,6 +729,9 @@ for opt do
>>>>>     ;;
>>>>>     --container-command=*) meson_option_add -Dcontainer_command="$optarg"
>>>>>     ;;
>>>>> +  --container-registry=*) container_registry="$optarg"
>>>>> +                          meson_option_add -Dcontainer_registry="$optarg"
>>>>> +  ;;
>>>>>     --rust-target-triple=*) rust_target_triple="$optarg"
>>>>>     ;;
>>>>>     --gdb=*) meson_option_add -Dgdb="$optarg"
>>>>> @@ -862,6 +866,7 @@ Advanced options (experts only):
>>>>>     --cpu=CPU                Build for host CPU [$cpu]
>>>>>     --disable-containers     don't use containers for cross-building
>>>>>     --container-command=CMD  which container command to use [autodetect]
>>>>> +  --container-registry=URL which container registry to cache from [$container_registry]
>>>>>     --gdb=GDB-path           gdb to use for gdbstub tests [autodetect]
>>>>>     --wasm64-32bit-address-limit Restrict wasm64 address space to 32-bit (default
>>>>>                                  is to use the whole 64-bit range).
>>>>> @@ -1318,6 +1323,9 @@ echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
>>>>>   echo "MESON=$meson" >> $config_host_mak
>>>>>   echo "NINJA=$ninja" >> $config_host_mak
>>>>>   echo "EXESUF=$EXESUF" >> $config_host_mak
>>>>> +if test -n "$container_registry"; then
>>>>> +  echo "DOCKER_DEFAULT_REGISTRY=$container_registry" >> $config_host_mak
>>>>> +fi
>>>>>   if test "$default_targets" = "yes"; then
>>>>>     echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
>>>>>   fi
>>>>> diff --git a/meson_options.txt b/meson_options.txt
>>>>> index 292625af08a..030231492e1 100644
>>>>> --- a/meson_options.txt
>>>>> +++ b/meson_options.txt
>>>>> @@ -391,6 +391,9 @@ option('containers', type: 'boolean', value: true,
>>>>>          description: 'use containers to cross compile tcg tests')
>>>>>   option('container_command', type: 'string',
>>>>>          description: 'command to build/run containers')
>>>>> +option('container_registry', type: 'string',
>>>>> +       value: 'registry.gitlab.com/qemu-project/qemu',
>>>>> +       description: 'container registry to cache from')
>>>>>     option('tcg_tests_cross_cc_aarch64', type: 'string',
>>>>>          description: 'cc for aarch64 tcg tests')
>>>>> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
>>>>> index 0adddb6a5c6..74bf471f171 100644
>>>>> --- a/tests/docker/Makefile.include
>>>>> +++ b/tests/docker/Makefile.include
>>>>> @@ -11,9 +11,7 @@ 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)
>>>>> -DOCKER_DEFAULT_REGISTRY := registry.gitlab.com/qemu-project/qemu
>>>>> -endif
>>>>> +DOCKER_DEFAULT_REGISTRY ?= registry.gitlab.com/qemu-project/qemu
>>>>>   DOCKER_REGISTRY := $(if $(REGISTRY),$(REGISTRY),$(DOCKER_DEFAULT_REGISTRY))
>>>>>
>>>>
>>>> Couldn't we read the default from config_host_mak generated by
>>>> configure instead?
>>>>
>>>>>   CONTAINER_COMMAND ?= $(shell $(SRC_PATH)/tests/docker/docker.py probe)
>>>>> diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
>>>>> index 814f2f8cd8c..22157a47c96 100644
>>>>> --- a/tests/tcg/meson.build
>>>>> +++ b/tests/tcg/meson.build
>>>>> @@ -101,6 +101,9 @@ if get_option('containers')
>>>>>     endif
>>>>>   endif
>>>>>   tcg_tests_summary += {'container command': container_command}
>>>>> +if get_option('container_registry') != ''
>>>>> +  tcg_tests_summary += {'container registry': get_option('container_registry')}
>>>>> +endif
>>>>>     # plugins come first, as we need to build the list
>>>>>   test_plugins = {}
>>>>> @@ -257,6 +260,9 @@ foreach target, plan: tcg_tests
>>>>>       if cc_dockerfile not in image_targets and has_docker
>>>>>         cmd = [docker_wrapper, 'build', '-f', dockerfile, '-t', 'qemu/' + cc_dockerfile,
>>>>>                '--add-current-user']
>>>>> +      if get_option('container_registry') != ''
>>>>> +        cmd += ['--registry', get_option('container_registry')]
>>>>> +      endif
>>>>>         t = custom_target(image_name, command: cmd,
>>>>>                           build_by_default: false,
>>>>>                           output: 'no_output_' + image_name)
>>>>
>>>> Do user benefit from this, or is it mostly for CI need?
>>>
>>> The aim is for faster image builds because the CI registry should always
>>> be up to date. Most of the time the images don't change.
>>>
>>
>> Ok. In this case, you need to add --timestamp 0 (that's enough in what I
>> tested) to original build command that generates those layers from our
>> CI, and use it here also. Else --cache-from does not work as intended
>> and you'll see have some duplication because timestamp is part of hash
>> for each layer.
>>
>> See this guide for more info:
>> https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html/building_running_and_managing_containers/introduction-to-reproducible-container-builds
> 
> Hmm is that a podman only option?
>

Yes, indeed.
Portable option seems to be: --build-arg SOURCE_DATE_EPOCH=0.

You can experiment with this using a personal registry (like dockerhub).

1. Build an image with:
--cache-to myregistry --build-arg SOURCE_DATE_EPOCH=0.
2. Then purge image and all its layers.
3. Rebuild it using:
--cache-from myregistry --build-arg SOURCE_DATE_EPOCH=0.
=> You should observe that all layers are effectively cached.

See a concrete example here:
original build:
https://github.com/p-b-o/qemu-ci/actions/runs/34837577836/job/103954828254#step:4:3170
cached build:
https://github.com/p-b-o/qemu-ci/actions/runs/34806642832/job/103859733976#step:6:9

Disclaimer: I exclusively use podman (for years), so not sure if docker
has its own idiosyncrasies on top.

>>>> The effect is to use --cache-from $registry, which I'm not sure is
>>>> what we want by default, given all the "caching issues" we had
>>>> previously with dockerfiles already.
>>>> If that's for CI, maybe it could simply set with --container-command
>>>> in our CI only.
>>>>
>>>> Regards,
>>>> Pierrick
>>>
> 



  reply	other threads:[~2026-09-15 17:50 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 18:14 [PATCH 0/9] testing: various docker clean-ups post meson tcg conversion Alex Bennée
2026-09-10 18:14 ` [PATCH 1/9] scripts/meson-buildoptions.sh: update missing options Alex Bennée
2026-09-10 20:03   ` Fabiano Rosas
2026-09-10 22:17     ` Alex Bennée
2026-09-14  5:00   ` Pierrick Bouvier
2026-09-14 10:22   ` Paolo Bonzini
2026-09-10 18:14 ` [PATCH 2/9] tests/tcg: improve check for working cross compilers Alex Bennée
2026-09-14  5:08   ` Pierrick Bouvier
2026-09-14  8:34     ` Daniel P. Berrangé
2026-09-14 16:05       ` Pierrick Bouvier
2026-09-14 16:07       ` Alex Bennée
2026-09-14 23:55         ` Ilya Leoshkevich
2026-09-15  0:21           ` Pierrick Bouvier
2026-09-10 18:14 ` [PATCH 3/9] tests/tcg: prefix meson built docker tags with qemu/ Alex Bennée
2026-09-14  5:10   ` Pierrick Bouvier
2026-09-10 18:14 ` [PATCH 4/9] tests/tcg: use --add-current-user when building containers Alex Bennée
2026-09-14  5:15   ` Pierrick Bouvier
2026-09-14  7:27     ` Alex Bennée
2026-09-14 15:59       ` Pierrick Bouvier
2026-09-10 18:15 ` [PATCH 5/9] tests/docker: add container registry to configure and use Alex Bennée
2026-09-14  5:21   ` Pierrick Bouvier
2026-09-14  7:28     ` Alex Bennée
2026-09-14 16:15       ` Pierrick Bouvier
2026-09-14 16:18       ` Pierrick Bouvier
2026-09-15 17:10         ` Alex Bennée
2026-09-15 17:49           ` Pierrick Bouvier [this message]
2026-09-10 18:15 ` [PATCH 6/9] tests/docker: remove used _read_qemu_dockerfile Alex Bennée
2026-09-14  5:21   ` Pierrick Bouvier
2026-09-10 18:15 ` [PATCH 7/9] tests/docker: strip remaining caching logic from docker.py Alex Bennée
2026-09-14  5:22   ` Pierrick Bouvier
2026-09-10 18:15 ` [PATCH 8/9] tests/docker: add specific command to parser Alex Bennée
2026-09-14  5:22   ` Pierrick Bouvier
2026-09-10 18:15 ` [PATCH 9/9] tests/docker: swap --quiet for --verbose Alex Bennée
2026-09-12  8:46 ` [PATCH 0/9] testing: various docker clean-ups post meson tcg conversion Richard Henderson
2026-09-12 17:24   ` Alex Bennée
2026-09-12 10:52 ` Richard Henderson
2026-09-12 19:37   ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=700467b2-f9a9-4192-aaeb-bcd3dd0dc6b7@oss.qualcomm.com \
    --to=pierrick.bouvier@oss.qualcomm.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=brad@comstyle.com \
    --cc=brian.cain@oss.qualcomm.com \
    --cc=cohuck@redhat.com \
    --cc=crosa@redhat.com \
    --cc=farosas@suse.de \
    --cc=gaosong@loongson.cn \
    --cc=imp@bsdimp.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=jsnow@redhat.com \
    --cc=kevans@freebsd.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@mailo.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=th.huth+qemu@posteo.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.