workflows.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guillaume Tucker <gtucker@gtucker.io>
To: "Onur Özkan" <work@onurozkan.dev>,
	"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>
Cc: Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nicolas.schier@linux.dev>,
	Miguel Ojeda <ojeda@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	automated-testing@lists.yoctoproject.org,
	Arnd Bergmann <arnd@arndb.de>,
	workflows@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [RFC PATCH 1/1] kbuild: add Makefile.container with CONTAINER option
Date: Tue, 14 Oct 2025 16:42:44 +0200	[thread overview]
Message-ID: <29c33635-cd83-4a47-aea0-460f196f1e3a@gtucker.io> (raw)
In-Reply-To: <20251014170842.2fc00c88@nimda.home>

Hi Onur,

On 14/10/2025 4:08 pm, Onur Özkan wrote:
> On Tue, 14 Oct 2025 13:58:10 +0200
> Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote:
> 
>> On Tue, Oct 14, 2025 at 11:45 AM Guillaume Tucker
>> <gtucker@gtucker.io> wrote:
>>>
>>> Add scripts/Makefile.container to wrap the make command in a
>>> container using the CONTAINER= variable to specify the image name.
>>> For example:
>>>
>>>      make -f scripts/Makefile.container CONTAINER=korg-gcc defconfig
>>>
>>> The container image name is entirely arbitrary and the container
>>> tool may be Docker, Podman or any other compatible alternative
>>> specified by the CONTAINER_COMMAND variable.  The default is set to
>>> docker for now.
>>
>> IIUC, this wraps reruns `make` inside the container, but it means
>> hardcoding a particular tool and path, right? (unless one sets even
>> more variables)
>>
>> The cover letter says one can create an alias for this, but one could
>> also do that for the underlying call anyway, unless I am missing
>> something. And if we do this, then I would prefer one doesn't need to
>> type `-f ...`.
>>
>> Put another way, for a user, what is the benefit of having this extra
>> way of running in a container? For instance, I could see the benefit
>> if different tools had different flags or it was a complicated
>> procedure, but I think at least `podman` shares the flags used here.
>>
>> Should this instead be a document inside `Documentation/` somewhere
>> that explains how to do this, pitfalls, advanced options, etc. and
>> give example command lines for different tools?
>>
>> If we do end up with `CONTAINER=`, then I think it should make it work
>> without having to pass `-f ...`, to make it easier. Or, even better,
>> like the KUnit script, we could have a script that does the right
>> thing and reads a config from the user, so that one can just type
>> something like, picking whatever tooling the user configured (e.g.
>> Docker vs. Podman, default image, etc.):
>>
>>      scripts/container.py defconfig
>>
> 
> I think this functionality would be better implemented as a script
> (like you mentioned) rather than a Makefile. The current approach is
> likely to run into several practical issues (e.g. file permission
> mismatches between host and container, the need to manually remove
> containers with `docker rm`, etc.) and addressing all of these
> reliably in Makefile can become quite messy. Writing a python (or even
> perl) script would make it much easier to maintain. Also, it can be
> self-documented quite nicely with `scripts/container.py --help` command.

Our emails have crossed - OK I'll take a look into this.  I fear a
script is actually going to be more difficult to maintain and will
require additional dependencies on the host i.e. Python.  But like I
wrote in my previous email, I'm happy to consider some alternatives
and see if we can find a consensus.

The issue with file ownership can be addressed with user id mapping
in principle.  Garbage collecting containers is not something I've
looked into as it's not a new problem compared to starting containers
explicitly.  I'll keep these things in mind too when comparing
solutions.

Thanks,
Guillaume

  reply	other threads:[~2025-10-14 14:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14  9:45 [RFC PATCH 0/1] kbuild: introduce containerized builds Guillaume Tucker
2025-10-14  9:45 ` [RFC PATCH 1/1] kbuild: add Makefile.container with CONTAINER option Guillaume Tucker
2025-10-14 11:58   ` Miguel Ojeda
2025-10-14 14:08     ` Onur Özkan
2025-10-14 14:42       ` Guillaume Tucker [this message]
2025-10-14 14:31     ` Guillaume Tucker
2025-10-14 15:42       ` Miguel Ojeda

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=29c33635-cd83-4a47-aea0-460f196f1e3a@gtucker.io \
    --to=gtucker@gtucker.io \
    --cc=arnd@arndb.de \
    --cc=automated-testing@lists.yoctoproject.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=nathan@kernel.org \
    --cc=nicolas.schier@linux.dev \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=work@onurozkan.dev \
    --cc=workflows@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox