Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootc: add --rootfs in bib image building #3390

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/provision/bootc/data/includes-deps.containerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/centos-bootc/centos-bootc:stream9
FROM quay.io/fedora/fedora-bootc:41

RUN dnf -y install cloud-init rsync && \
ln -s ../cloud-init.target /usr/lib/systemd/system/default.target.wants && \
Expand Down
7 changes: 7 additions & 0 deletions tmt/schemas/provision/bootc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,12 @@ properties:
image-builder:
type: string

rootfs:
type: string
enum:
- ext4
- xfs
- btrfs

required:
- how
18 changes: 16 additions & 2 deletions tmt/steps/provision/bootc.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ class BootcData(tmt.steps.provision.testcloud.ProvisionTestcloudData):
building the bootc disk image.
""")

rootfs: str = field(
default="xfs",
option=('--rootfs'),
metavar='ROOTFS',
help="""
Select root filesystem type. Overrides the default from the source
container. Supported value: ext4, xfs, and btrfs
""")
henrywang marked this conversation as resolved.
Show resolved Hide resolved


@tmt.steps.provides_method('bootc')
class ProvisionBootc(tmt.steps.provision.ProvisionPlugin[BootcData]):
Expand All @@ -148,6 +157,7 @@ class ProvisionBootc(tmt.steps.provision.ProvisionPlugin[BootcData]):
provision:
how: bootc
container-image: quay.io/centos-bootc/centos-bootc:stream9
rootfs: xfs

Here's a config example using a Containerfile:

Expand All @@ -158,6 +168,7 @@ class ProvisionBootc(tmt.steps.provision.ProvisionPlugin[BootcData]):
container-file: "./my-custom-image.containerfile"
container-file-workdir: .
image-builder: quay.io/centos-bootc/bootc-image-builder:stream9
rootfs: ext4
disk: 100

Another config example using an image that already includes tmt
Expand All @@ -169,6 +180,7 @@ class ProvisionBootc(tmt.steps.provision.ProvisionPlugin[BootcData]):
how: bootc
add-tmt-dependencies: false
container-image: localhost/my-image-with-deps
rootfs: btrfs

This plugin is an extension of the virtual.testcloud plugin.
Essentially, it takes a container image as input, builds a
Expand Down Expand Up @@ -252,7 +264,7 @@ def _build_base_image(self, containerfile: str, workdir: str) -> str:
env=PODMAN_ENV if self._rootless else None)
return image_tag

def _build_bootc_disk(self, containerimage: str, image_builder: str) -> None:
def _build_bootc_disk(self, containerimage: str, image_builder: str, rootfs: str) -> None:
""" Build the bootc disk from a container image using bootc image builder """
self._logger.debug("Build bootc disk image.")

Expand All @@ -271,6 +283,8 @@ def _build_bootc_disk(self, containerimage: str, image_builder: str) -> None:
"build",
"--type",
"qcow2",
"--rootfs",
rootfs,
HuijingHei marked this conversation as resolved.
Show resolved Hide resolved
"--local",
containerimage).run(
cwd=self.workdir,
Expand Down Expand Up @@ -334,7 +348,7 @@ def go(self, *, logger: Optional[tmt.log.Logger] = None) -> None:
data.container_file, data.container_file_workdir)
if data.add_tmt_dependencies:
containerimage = self._build_derived_image(containerimage)
self._build_bootc_disk(containerimage, data.image_builder)
self._build_bootc_disk(containerimage, data.image_builder, data.rootfs)

# Image of file have to provided
else:
Expand Down