On Fri, Feb 25, 2022 at 02:09:13PM +0000, Daniel P. Berrangé wrote:
I've never got on very well with the 'lcitool build'
command as its
a bit of a black box you don't have much control over. In its current
impl, it also means that lcitool has to know about build commands for
each project which is unfortunate.
My proposal to standardize on running a ci/build script that's
maintained as part of the project itself, and that is also used for
the regular CI jobs, would address this.
If we're going to wire up support for containers, I think we
should
start by just creating a 'lcitool run $target-or-host' command that
brings up an environment with an interactive shell, with the current
source present. eg
$ lcitool run fedora-35
This becomes a lot of fun when you start considering how to have a
consistent interface across containers and VMs. Exposing the local
git tree to a container is sort of easy (even though there are a
number of caveats) but to achieve the same result with a VM you'd
need to get something like virtiofs involved and coordinate with the
guest OS in non trivial ways...
We could then let it take a command + args to run as extra args
eg
$ lcitool run fedora-35 meson build
$ lcitool run fedora-35 ninja -C build
would just work with VM, but for containers you would need the
container FS to be persistent across runs. This could be achieved
by giving the container an explicit name, so you just re-restart
the same container each time instead of using a throwaway container.
The basic idea though is that running stuff inside the container/VM
is just the same as running stuff in your local checkout. The exact
same command name(s0, just prefixed with 'lcitool run fedora-35'.
Or in my case I'd add an alias
alias f35='lcitool run fedora-35'
so i can do
$ f35 meson build
$ f35 ninja -C bujld
If you're trying to reproduce a CI failure locally so that you can
debug it, or performing validation before posting patches, you don't
want to spell out the build steps this way. What you want is to call
$ lcitool build fedora-35 --container
and get the same failure you've seen in the CI pipeline, because the
same steps have been executed in the same container image.
To debug the failure, you should be able to either run something like
$ lcitool shell fedora-35 --container
and run ./ci/build yourself, or even better be offered the chance to
spawn an interactive shell as soon as 'lcitool build' figures out
that a failure has occurred.
Some way to optionally keep the container's state around so that you
can return to it at a later time would be desirable, but that's more
of an optimization than something that's really necessary for regular
usage.
--
Andrea Bolognani / Red Hat / Virtualization