Skip to content

images: provide the ability to generate bootc disk images (HMS-8844)#1656

Closed
mvo5 wants to merge 24 commits intoosbuild:mainfrom
mvo5:bib-images-convergence-disk-only-for-now
Closed

images: provide the ability to generate bootc disk images (HMS-8844)#1656
mvo5 wants to merge 24 commits intoosbuild:mainfrom
mvo5:bib-images-convergence-disk-only-for-now

Conversation

@mvo5
Copy link
Contributor

@mvo5 mvo5 commented Jul 11, 2025

[draft as this needs https://github.com//pull/1655 and lacks a bunch of tests]

This branch provides a way to create an imageType from a bootc reference.

With that the API user can do:

imgType, err := distro.ImageFromBootc(bootcRef, imgTypeName, archStr)
...

and that can then be passed to manifestgen.

/jira-epic HMS-8839

JIRA: HMS-8844

@schutzbot schutzbot changed the title images: provide the ability to generate bootc disk images images: provide the ability to generate bootc disk images (HMS-8844) Jul 16, 2025
@mvo5 mvo5 force-pushed the bib-images-convergence-disk-only-for-now branch 2 times, most recently from 4943958 to a68c75a Compare July 18, 2025 16:16
@mvo5 mvo5 force-pushed the bib-images-convergence-disk-only-for-now branch 2 times, most recently from 1ec1ce2 to af83333 Compare July 30, 2025 09:54
When we move to bootc we need a way to declare that certain
partitions use the distribution default filesystem as the
partition table itself is generic. This commit adds support
in the YAML to write:
```yaml
    partition_table:
      test_arch:
        partitions:
          - payload_type: filesystem
            payload:
              type: distro-default
              mountpoint: "/"
```
which will then translated at YAML load time to the default
filesystem declared by the distribution. This allows us to
write a generic YAML based partition table in images that
is the same as the partition table in bootc-image-builder.
mvo5 added 14 commits July 31, 2025 17:35
This commit adds support for creating bootc image types in a
similar way as "normal" image types, i.e.:
1. Add an ImageOption to pass the Bootc container ref
2. Add `bootc_disk` as a possible `image_func:` in the YAML
3. Add `bootcDiskImage` in the generic images.go function
4. Add (erroring) BootcDiskImage.InstantiateManifest()

With that we can (almost) use the normal image type flow
for bootc images. What is missing is:
1. pkg/distro/generic:imageType.Manifest() expects to call
   BootcDiskImage.InstantiateManifest() but currently needs
   to call BootcDiskImage.InstantiateManifestFromContainer()
2. Something needs to "populate" the bootc distro, i.e. some
   helpers are needed that take a bootc ref and create a
   distro/arch/imagetypes from that
This commit adds support to instanciate bootc based images
in the `imageType.Manifest()` function. This is needed
because a bootc disk image needs container SourceSpecs
instead of repositories to initialize.

Note that we could also change the interface of
ImageKind.InstantiateManifest() and add e.g.
container.SourceSpec there or provide a new struct type
inputs that contains both repositories and container
specs. But doing this is a bigger change with more churn.
This commit strips the extension from the bootc
base filename as the images library will add
the extensions based on the image type.
This commit adds support to create an (distro, arch, imgType)
tuple from a bootc reference. With that the API user
can do:
```go
imgType, err := distro.ImageFromBootc(bootcRef, imgTypeName, archStr)
...
```
and those can then be passed to manifestgen.
This commit adds all bootc disk image types as YAML. The
`BootcDiskImage` is special in that it generates all
image types in the manifest anyway so this does not
fully reflect reality but its close enough so that the
images library can now work with bootc disk image types.

Note that for the ISO a bit more work is needed, here the
missing piece is that we need to pass use a custom
depsolver that operates on the container. This is already
almost possible via the "manifestgen.Depsolver" helper.
Its future work though.
Add a `--bootc-ref` so that we can generate manifests for bootc
container based images.
Similar to moving ami/qcow2 etc into YAML definitions this
commit moves the `anaconda-iso` into YAML.

This means that the consumer of the library can create a
generic distro with `distro.ImageFromBootc()` and then
get the `anaconda-iso` installer from that image type.
This commit makes the qcow2/x86_64 manifests identical
(except for UUIDs). It copies code from bib to set the
default rootfs right now, this needs to be done cleaner.
Add the bootc specific kernel options to the bootc disk types, with
that the manifest diff between images and bib is identical (except
for different UUIDs due to different amounts of math.Rand() calls.
@mvo5 mvo5 force-pushed the bib-images-convergence-disk-only-for-now branch from af83333 to cbe2994 Compare July 31, 2025 15:40
@mvo5 mvo5 force-pushed the bib-images-convergence-disk-only-for-now branch from 5cea429 to b9cf68f Compare July 31, 2025 16:07
This is a behavior change, traditionally we hardcoded
xfs for filesystem customizations.
mvo5 added 4 commits August 1, 2025 13:24
This commit moves the mount point and custom directory and
file policies from the bootc-image-builder repository into
"images".
@mvo5 mvo5 force-pushed the bib-images-convergence-disk-only-for-now branch from 2ee5b66 to 0d16cf6 Compare August 4, 2025 10:03
@mvo5 mvo5 force-pushed the bib-images-convergence-disk-only-for-now branch from 3b130c6 to 382e17c Compare August 4, 2025 12:07
mvo5 added a commit to mvo5/images that referenced this pull request Aug 5, 2025
This commit creates a new `pkg/distro/bootc` that registers into
the distrofacory and provides a "normal" distro.{Distro,Arch,ImgType}
abstraction. Because of the way we create distros (via the
reporegistry) it will need to be instanciated directly like this:
```
distro := bootc.NewBootcDistro(imgRef)
```
but once we work more on the distrofactory/reporegistry interaction
this will most likly change and the regular distrofactory can be
used.

A bootc based distro defines itself by inspecting the underlying
bootc image and sets various properties (like the default rootfs)
based on this container inspection.

In this version we just copy the code from `bootc-image-builder`
that is concerned with the manifest creation. This means there
is some duplication with the existing code in `images`. While
this is not ideal it makes it easier to do the followup cleanups
and it is easier to be sure that there are no behavioral changes.

In this initial version only the disk based image types are moving,
the installer type will follow. Unfortunately the git history of
the image-builder code is not included, I can't think of a good
way of doing it as we are only including parts of the file.

This is a first step towards osbuild#1656
mvo5 added a commit to mvo5/images that referenced this pull request Aug 7, 2025
This commit creates a new `pkg/distro/bootc` that registers into
the distrofacory and provides a "normal" distro.{Distro,Arch,ImgType}
abstraction. Because of the way we create distros (via the
reporegistry) it will need to be instanciated directly like this:
```
distro := bootc.NewBootcDistro(imgRef)
```
but once we work more on the distrofactory/reporegistry interaction
this will most likly change and the regular distrofactory can be
used.

A bootc based distro defines itself by inspecting the underlying
bootc image and sets various properties (like the default rootfs)
based on this container inspection.

In this version we just copy the code from `bootc-image-builder`
that is concerned with the manifest creation. This means there
is some duplication with the existing code in `images`. While
this is not ideal it makes it easier to do the followup cleanups
and it is easier to be sure that there are no behavioral changes.

In this initial version only the disk based image types are moving,
the installer type will follow. Unfortunately the git history of
the image-builder code is not included, I can't think of a good
way of doing it as we are only including parts of the file.

This is a first step towards osbuild#1656
mvo5 added a commit to mvo5/images that referenced this pull request Aug 7, 2025
This commit creates a new `pkg/distro/bootc` that registers into
the distrofacory and provides a "normal" distro.{Distro,Arch,ImgType}
abstraction. Because of the way we create distros (via the
reporegistry) it will need to be instanciated directly like this:
```
distro := bootc.NewBootcDistro(imgRef)
```
but once we work more on the distrofactory/reporegistry interaction
this will most likly change and the regular distrofactory can be
used.

A bootc based distro defines itself by inspecting the underlying
bootc image and sets various properties (like the default rootfs)
based on this container inspection.

In this version we just copy the code from `bootc-image-builder`
that is concerned with the manifest creation. This means there
is some duplication with the existing code in `images`. While
this is not ideal it makes it easier to do the followup cleanups
and it is easier to be sure that there are no behavioral changes.

In this initial version only the disk based image types are moving,
the installer type will follow. Unfortunately the git history of
the image-builder code is not included, I can't think of a good
way of doing it as we are only including parts of the file.

This is a first step towards osbuild#1656
@mvo5
Copy link
Contributor Author

mvo5 commented Aug 7, 2025

Closing in favor of #1736 - I think we wan to get back to this one but as a second step.

@mvo5 mvo5 closed this Aug 7, 2025
mvo5 added a commit to mvo5/images that referenced this pull request Aug 7, 2025
This commit creates a new `pkg/distro/bootc` that registers into
the distrofacory and provides a "normal" distro.{Distro,Arch,ImgType}
abstraction. Because of the way we create distros (via the
reporegistry) it will need to be instanciated directly like this:
```
distro := bootc.NewBootcDistro(imgRef)
```
but once we work more on the distrofactory/reporegistry interaction
this will most likly change and the regular distrofactory can be
used.

A bootc based distro defines itself by inspecting the underlying
bootc image and sets various properties (like the default rootfs)
based on this container inspection.

In this version we just copy the code from `bootc-image-builder`
that is concerned with the manifest creation. This means there
is some duplication with the existing code in `images`. While
this is not ideal it makes it easier to do the followup cleanups
and it is easier to be sure that there are no behavioral changes.

In this initial version only the disk based image types are moving,
the installer type will follow. Unfortunately the git history of
the image-builder code is not included, I can't think of a good
way of doing it as we are only including parts of the file.

This is a first step towards osbuild#1656
mvo5 added a commit to mvo5/images that referenced this pull request Aug 18, 2025
This commit creates a new `pkg/distro/bootc` that registers into
the distrofacory and provides a "normal" distro.{Distro,Arch,ImgType}
abstraction. Because of the way we create distros (via the
reporegistry) it will need to be instanciated directly like this:
```
distro := bootc.NewBootcDistro(imgRef)
```
but once we work more on the distrofactory/reporegistry interaction
this will most likly change and the regular distrofactory can be
used.

A bootc based distro defines itself by inspecting the underlying
bootc image and sets various properties (like the default rootfs)
based on this container inspection.

In this version we just copy the code from `bootc-image-builder`
that is concerned with the manifest creation. This means there
is some duplication with the existing code in `images`. While
this is not ideal it makes it easier to do the followup cleanups
and it is easier to be sure that there are no behavioral changes.

In this initial version only the disk based image types are moving,
the installer type will follow. Unfortunately the git history of
the image-builder code is not included, I can't think of a good
way of doing it as we are only including parts of the file.

This is a first step towards osbuild#1656
github-merge-queue bot pushed a commit that referenced this pull request Aug 27, 2025
This commit creates a new `pkg/distro/bootc` that registers into
the distrofacory and provides a "normal" distro.{Distro,Arch,ImgType}
abstraction. Because of the way we create distros (via the
reporegistry) it will need to be instanciated directly like this:
```
distro := bootc.NewBootcDistro(imgRef)
```
but once we work more on the distrofactory/reporegistry interaction
this will most likly change and the regular distrofactory can be
used.

A bootc based distro defines itself by inspecting the underlying
bootc image and sets various properties (like the default rootfs)
based on this container inspection.

In this version we just copy the code from `bootc-image-builder`
that is concerned with the manifest creation. This means there
is some duplication with the existing code in `images`. While
this is not ideal it makes it easier to do the followup cleanups
and it is easier to be sure that there are no behavioral changes.

In this initial version only the disk based image types are moving,
the installer type will follow. Unfortunately the git history of
the image-builder code is not included, I can't think of a good
way of doing it as we are only including parts of the file.

This is a first step towards #1656
supakeen pushed a commit to mvo5/images that referenced this pull request Aug 27, 2025
This commit creates a new `pkg/distro/bootc` that registers into
the distrofacory and provides a "normal" distro.{Distro,Arch,ImgType}
abstraction. Because of the way we create distros (via the
reporegistry) it will need to be instanciated directly like this:
```
distro := bootc.NewBootcDistro(imgRef)
```
but once we work more on the distrofactory/reporegistry interaction
this will most likly change and the regular distrofactory can be
used.

A bootc based distro defines itself by inspecting the underlying
bootc image and sets various properties (like the default rootfs)
based on this container inspection.

In this version we just copy the code from `bootc-image-builder`
that is concerned with the manifest creation. This means there
is some duplication with the existing code in `images`. While
this is not ideal it makes it easier to do the followup cleanups
and it is easier to be sure that there are no behavioral changes.

In this initial version only the disk based image types are moving,
the installer type will follow. Unfortunately the git history of
the image-builder code is not included, I can't think of a good
way of doing it as we are only including parts of the file.

This is a first step towards osbuild#1656
mvo5 added a commit to mvo5/images that referenced this pull request Aug 27, 2025
This commit creates a new `pkg/distro/bootc` that registers into
the distrofacory and provides a "normal" distro.{Distro,Arch,ImgType}
abstraction. Because of the way we create distros (via the
reporegistry) it will need to be instanciated directly like this:
```
distro := bootc.NewBootcDistro(imgRef)
```
but once we work more on the distrofactory/reporegistry interaction
this will most likly change and the regular distrofactory can be
used.

A bootc based distro defines itself by inspecting the underlying
bootc image and sets various properties (like the default rootfs)
based on this container inspection.

In this version we just copy the code from `bootc-image-builder`
that is concerned with the manifest creation. This means there
is some duplication with the existing code in `images`. While
this is not ideal it makes it easier to do the followup cleanups
and it is easier to be sure that there are no behavioral changes.

In this initial version only the disk based image types are moving,
the installer type will follow. Unfortunately the git history of
the image-builder code is not included, I can't think of a good
way of doing it as we are only including parts of the file.

This is a first step towards osbuild#1656
github-merge-queue bot pushed a commit that referenced this pull request Aug 27, 2025
This commit creates a new `pkg/distro/bootc` that registers into
the distrofacory and provides a "normal" distro.{Distro,Arch,ImgType}
abstraction. Because of the way we create distros (via the
reporegistry) it will need to be instanciated directly like this:
```
distro := bootc.NewBootcDistro(imgRef)
```
but once we work more on the distrofactory/reporegistry interaction
this will most likly change and the regular distrofactory can be
used.

A bootc based distro defines itself by inspecting the underlying
bootc image and sets various properties (like the default rootfs)
based on this container inspection.

In this version we just copy the code from `bootc-image-builder`
that is concerned with the manifest creation. This means there
is some duplication with the existing code in `images`. While
this is not ideal it makes it easier to do the followup cleanups
and it is easier to be sure that there are no behavioral changes.

In this initial version only the disk based image types are moving,
the installer type will follow. Unfortunately the git history of
the image-builder code is not included, I can't think of a good
way of doing it as we are only including parts of the file.

This is a first step towards #1656
github-merge-queue bot pushed a commit that referenced this pull request Aug 27, 2025
This commit creates a new `pkg/distro/bootc` that registers into
the distrofacory and provides a "normal" distro.{Distro,Arch,ImgType}
abstraction. Because of the way we create distros (via the
reporegistry) it will need to be instanciated directly like this:
```
distro := bootc.NewBootcDistro(imgRef)
```
but once we work more on the distrofactory/reporegistry interaction
this will most likly change and the regular distrofactory can be
used.

A bootc based distro defines itself by inspecting the underlying
bootc image and sets various properties (like the default rootfs)
based on this container inspection.

In this version we just copy the code from `bootc-image-builder`
that is concerned with the manifest creation. This means there
is some duplication with the existing code in `images`. While
this is not ideal it makes it easier to do the followup cleanups
and it is easier to be sure that there are no behavioral changes.

In this initial version only the disk based image types are moving,
the installer type will follow. Unfortunately the git history of
the image-builder code is not included, I can't think of a good
way of doing it as we are only including parts of the file.

This is a first step towards #1656
mvo5 added a commit to mvo5/images that referenced this pull request Aug 27, 2025
This commit creates a new `pkg/distro/bootc` that registers into
the distrofacory and provides a "normal" distro.{Distro,Arch,ImgType}
abstraction. Because of the way we create distros (via the
reporegistry) it will need to be instanciated directly like this:
```
distro := bootc.NewBootcDistro(imgRef)
```
but once we work more on the distrofactory/reporegistry interaction
this will most likly change and the regular distrofactory can be
used.

A bootc based distro defines itself by inspecting the underlying
bootc image and sets various properties (like the default rootfs)
based on this container inspection.

In this version we just copy the code from `bootc-image-builder`
that is concerned with the manifest creation. This means there
is some duplication with the existing code in `images`. While
this is not ideal it makes it easier to do the followup cleanups
and it is easier to be sure that there are no behavioral changes.

In this initial version only the disk based image types are moving,
the installer type will follow. Unfortunately the git history of
the image-builder code is not included, I can't think of a good
way of doing it as we are only including parts of the file.

This is a first step towards osbuild#1656
github-merge-queue bot pushed a commit that referenced this pull request Aug 27, 2025
This commit creates a new `pkg/distro/bootc` that registers into
the distrofacory and provides a "normal" distro.{Distro,Arch,ImgType}
abstraction. Because of the way we create distros (via the
reporegistry) it will need to be instanciated directly like this:
```
distro := bootc.NewBootcDistro(imgRef)
```
but once we work more on the distrofactory/reporegistry interaction
this will most likly change and the regular distrofactory can be
used.

A bootc based distro defines itself by inspecting the underlying
bootc image and sets various properties (like the default rootfs)
based on this container inspection.

In this version we just copy the code from `bootc-image-builder`
that is concerned with the manifest creation. This means there
is some duplication with the existing code in `images`. While
this is not ideal it makes it easier to do the followup cleanups
and it is easier to be sure that there are no behavioral changes.

In this initial version only the disk based image types are moving,
the installer type will follow. Unfortunately the git history of
the image-builder code is not included, I can't think of a good
way of doing it as we are only including parts of the file.

This is a first step towards #1656
mvo5 added a commit to mvo5/images that referenced this pull request Aug 28, 2025
This fixes a bug in the new bootc based imagetypes. The
filename was not returned with the correct extension.
The reason is that the the file extension is hardcoded in
pkg/image/bootc_disk.go, we have no way to access this
information the level when the image type is generated.

When the bootc imagetypes move into YAML the problem
hopefully solves itself as will then set the filename
in the YAML just like we do for the other image types
(this will need changes to bootc_disk.go then too).

So this commit needs to duplicate it for now. No
explicit test as this is indirectly tested via ibcli
and it will go away when moving into yaml based bootc
definitions (see osbuild#1656
for an outline what that might look like).

(fwiw with osbuild#1039
this wouldn't be an issue for ibcli).
mvo5 added a commit to mvo5/images that referenced this pull request Aug 28, 2025
This fixes a bug in the new bootc based imagetypes. The
filename was not returned with the correct extension.
The reason is that the the file extension is hardcoded in
pkg/image/bootc_disk.go, we have no way to access this
information the level when the image type is generated.

When the bootc imagetypes move into YAML the problem
hopefully solves itself as will then set the filename
in the YAML just like we do for the other image types
(this will need changes to bootc_disk.go then too).

So this commit needs to duplicate it for now. No
explicit test as this is indirectly tested via ibcli
and it will go away when moving into yaml based bootc
definitions (see osbuild#1656
for an outline what that might look like).

(fwiw with osbuild#1039
this wouldn't be an issue for ibcli).
github-merge-queue bot pushed a commit that referenced this pull request Aug 28, 2025
This fixes a bug in the new bootc based imagetypes. The
filename was not returned with the correct extension.
The reason is that the the file extension is hardcoded in
pkg/image/bootc_disk.go, we have no way to access this
information the level when the image type is generated.

When the bootc imagetypes move into YAML the problem
hopefully solves itself as will then set the filename
in the YAML just like we do for the other image types
(this will need changes to bootc_disk.go then too).

So this commit needs to duplicate it for now. No
explicit test as this is indirectly tested via ibcli
and it will go away when moving into yaml based bootc
definitions (see #1656
for an outline what that might look like).

(fwiw with #1039
this wouldn't be an issue for ibcli).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants