2025-09-28 22:58:27 +02:00
|
|
|
# Build this project from source and write the updated content
|
|
|
|
|
# (i.e. /usr/bin/bootc and systemd units) to a new derived container
|
|
|
|
|
# image. See the `Justfile` for an example
|
2025-06-06 11:11:58 -04:00
|
|
|
|
Rework GHA testing: Use bcvk, cover composefs with tmt
Part 1: Use bcvk
For local tests, right now testcloud+tmt doesn't support UEFI, see
https://github.com/teemtee/tmt/issues/4203
This is a blocker for us doing more testing with UKIs.
In this patch we switch to provisioning VMs with bcvk, which
fixes this - but beyond that a really compelling thing about
this is that bcvk is *also* designed to be ergonomic and efficient
beyond just being a test runner, with things like virtiofs
mounting of host container storage, etc.
In other words, bcvk is the preferred way to run local virt
with bootc, and this makes our TMT tests use it.
Now a major downside of this though is we're effectively
implementing a new "provisioner" for tmt (bypassing the
existing `virtual`). In the more medium term I think we
want to add `bcvk` as a provisioner option to tmt.
Anyways for now, this works by discovers test plans via `tmt plan ls`,
spawning a separate VM per test, and then using uses tmt's connect
provisioner to run tests targeting these externally provisioned
systems.
Part 2: Rework the Justfile and Dockerfile
This adds `base` and `variant` arguments which are propagated through
the system, and we have a new `variant` for sealed composefs.
The readonly tests now pass with composefs.
Drop the continuous repo tests...as while we could keep
that it's actually a whole *other* entry in this matrix.
Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-04 09:20:56 -05:00
|
|
|
# Note this is usually overridden via Justfile
|
2025-09-28 22:58:27 +02:00
|
|
|
ARG base=quay.io/centos-bootc/centos-bootc:stream10
|
2025-06-06 11:11:58 -04:00
|
|
|
|
2025-09-28 22:58:27 +02:00
|
|
|
# This first image captures a snapshot of the source code,
|
|
|
|
|
# note all the exclusions in .dockerignore.
|
2025-06-06 11:11:58 -04:00
|
|
|
FROM scratch as src
|
|
|
|
|
COPY . /src
|
|
|
|
|
|
2025-11-16 11:48:43 -05:00
|
|
|
# And this image only captures contrib/packaging separately
|
|
|
|
|
# to ensure we have more precise cache hits.
|
|
|
|
|
FROM scratch as packaging
|
|
|
|
|
COPY contrib/packaging /
|
|
|
|
|
|
2025-11-26 10:00:33 -05:00
|
|
|
# This image captures pre-built packages from the context.
|
|
|
|
|
# By COPYing into a stage, we avoid SELinux issues with context bind mounts.
|
|
|
|
|
FROM scratch as packages
|
|
|
|
|
COPY target/packages/*.rpm /
|
|
|
|
|
|
2025-07-24 11:44:22 -04:00
|
|
|
FROM $base as base
|
2025-11-16 11:48:43 -05:00
|
|
|
# Mark this as a test image (moved from --label build flag to fix layer caching)
|
|
|
|
|
LABEL bootc.testimage="1"
|
2025-07-24 11:44:22 -04:00
|
|
|
|
2025-06-06 11:11:58 -04:00
|
|
|
# This image installs build deps, pulls in our source code, and installs updated
|
|
|
|
|
# bootc binaries in /out. The intention is that the target rootfs is extracted from /out
|
2025-09-28 22:58:27 +02:00
|
|
|
# back into a final stage (without the build deps etc) below.
|
2025-11-16 11:48:43 -05:00
|
|
|
FROM base as buildroot
|
2025-09-24 14:27:34 -04:00
|
|
|
# Flip this off to disable initramfs code
|
|
|
|
|
ARG initramfs=1
|
2025-11-16 11:48:43 -05:00
|
|
|
# This installs our buildroot, and we want to cache it independently of the rest.
|
|
|
|
|
# Basically we don't want changing a .rs file to blow out the cache of packages.
|
|
|
|
|
RUN --mount=type=bind,from=packaging,target=/run/packaging /run/packaging/install-buildroot
|
2025-06-06 11:11:58 -04:00
|
|
|
# Now copy the rest of the source
|
|
|
|
|
COPY --from=src /src /src
|
|
|
|
|
WORKDIR /src
|
|
|
|
|
# See https://www.reddit.com/r/rust/comments/126xeyx/exploring_the_problem_of_faster_cargo_docker/
|
|
|
|
|
# We aren't using the full recommendations there, just the simple bits.
|
2025-10-31 21:02:39 -04:00
|
|
|
# First we download all of our Rust dependencies
|
|
|
|
|
RUN --mount=type=cache,target=/src/target --mount=type=cache,target=/var/roothome cargo fetch
|
2025-11-16 11:48:43 -05:00
|
|
|
|
|
|
|
|
FROM buildroot as build
|
2025-11-27 17:03:36 +08:00
|
|
|
# Version for RPM build (optional, computed from git in Justfile)
|
|
|
|
|
ARG pkgversion
|
2025-11-16 11:48:43 -05:00
|
|
|
# Build RPM directly from source, using cached target directory
|
2025-11-27 14:48:43 +08:00
|
|
|
RUN --mount=type=cache,target=/src/target --mount=type=cache,target=/var/roothome --network=none RPM_VERSION="${pkgversion}" /src/contrib/packaging/build-rpm
|
2025-06-06 11:11:58 -04:00
|
|
|
|
2025-09-22 14:48:13 -04:00
|
|
|
# This "build" includes our unit tests
|
2025-06-06 11:11:58 -04:00
|
|
|
FROM build as units
|
2025-09-22 14:48:13 -04:00
|
|
|
# A place that we're more likely to be able to set xattrs
|
|
|
|
|
VOLUME /var/tmp
|
|
|
|
|
ENV TMPDIR=/var/tmp
|
2025-10-31 21:02:39 -04:00
|
|
|
RUN --mount=type=cache,target=/src/target --mount=type=cache,target=/var/roothome --network=none make install-unit-tests
|
2025-09-22 14:48:13 -04:00
|
|
|
|
|
|
|
|
# This just does syntax checking
|
|
|
|
|
FROM build as validate
|
2025-10-31 21:02:39 -04:00
|
|
|
RUN --mount=type=cache,target=/src/target --mount=type=cache,target=/var/roothome --network=none make validate
|
2025-06-06 11:11:58 -04:00
|
|
|
|
|
|
|
|
# The final image that derives from the original base and adds the release binaries
|
2025-07-24 11:44:22 -04:00
|
|
|
FROM base
|
Rework GHA testing: Use bcvk, cover composefs with tmt
Part 1: Use bcvk
For local tests, right now testcloud+tmt doesn't support UEFI, see
https://github.com/teemtee/tmt/issues/4203
This is a blocker for us doing more testing with UKIs.
In this patch we switch to provisioning VMs with bcvk, which
fixes this - but beyond that a really compelling thing about
this is that bcvk is *also* designed to be ergonomic and efficient
beyond just being a test runner, with things like virtiofs
mounting of host container storage, etc.
In other words, bcvk is the preferred way to run local virt
with bootc, and this makes our TMT tests use it.
Now a major downside of this though is we're effectively
implementing a new "provisioner" for tmt (bypassing the
existing `virtual`). In the more medium term I think we
want to add `bcvk` as a provisioner option to tmt.
Anyways for now, this works by discovers test plans via `tmt plan ls`,
spawning a separate VM per test, and then using uses tmt's connect
provisioner to run tests targeting these externally provisioned
systems.
Part 2: Rework the Justfile and Dockerfile
This adds `base` and `variant` arguments which are propagated through
the system, and we have a new `variant` for sealed composefs.
The readonly tests now pass with composefs.
Drop the continuous repo tests...as while we could keep
that it's actually a whole *other* entry in this matrix.
Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-04 09:20:56 -05:00
|
|
|
# See the Justfile for possible variants
|
|
|
|
|
ARG variant
|
2025-11-16 11:48:43 -05:00
|
|
|
RUN --mount=type=bind,from=packaging,target=/run/packaging /run/packaging/configure-variant "${variant}"
|
Rework GHA testing: Use bcvk, cover composefs with tmt
Part 1: Use bcvk
For local tests, right now testcloud+tmt doesn't support UEFI, see
https://github.com/teemtee/tmt/issues/4203
This is a blocker for us doing more testing with UKIs.
In this patch we switch to provisioning VMs with bcvk, which
fixes this - but beyond that a really compelling thing about
this is that bcvk is *also* designed to be ergonomic and efficient
beyond just being a test runner, with things like virtiofs
mounting of host container storage, etc.
In other words, bcvk is the preferred way to run local virt
with bootc, and this makes our TMT tests use it.
Now a major downside of this though is we're effectively
implementing a new "provisioner" for tmt (bypassing the
existing `virtual`). In the more medium term I think we
want to add `bcvk` as a provisioner option to tmt.
Anyways for now, this works by discovers test plans via `tmt plan ls`,
spawning a separate VM per test, and then using uses tmt's connect
provisioner to run tests targeting these externally provisioned
systems.
Part 2: Rework the Justfile and Dockerfile
This adds `base` and `variant` arguments which are propagated through
the system, and we have a new `variant` for sealed composefs.
The readonly tests now pass with composefs.
Drop the continuous repo tests...as while we could keep
that it's actually a whole *other* entry in this matrix.
Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-04 09:20:56 -05:00
|
|
|
# Support overriding the rootfs at build time conveniently
|
2025-11-27 17:03:36 +08:00
|
|
|
ARG rootfs
|
2025-11-16 11:48:43 -05:00
|
|
|
RUN --mount=type=bind,from=packaging,target=/run/packaging /run/packaging/configure-rootfs "${variant}" "${rootfs}"
|
2025-11-18 22:06:44 -05:00
|
|
|
# Inject additional content
|
|
|
|
|
COPY --from=packaging /usr-extras/ /usr/
|
2025-11-26 10:00:33 -05:00
|
|
|
# Install packages from the packages stage
|
|
|
|
|
# Using bind from a stage avoids SELinux issues with context bind mounts
|
|
|
|
|
RUN --mount=type=bind,from=packaging,target=/run/packaging \
|
|
|
|
|
--mount=type=bind,from=packages,target=/build-packages \
|
|
|
|
|
--network=none \
|
|
|
|
|
/run/packaging/install-rpm-and-setup /build-packages
|
2025-11-16 11:48:43 -05:00
|
|
|
# Finally, testour own linting
|
|
|
|
|
RUN bootc container lint --fatal-warnings
|