images: provide the ability to generate bootc disk images (HMS-8844)#1656
Closed
mvo5 wants to merge 24 commits intoosbuild:mainfrom
Closed
images: provide the ability to generate bootc disk images (HMS-8844)#1656mvo5 wants to merge 24 commits intoosbuild:mainfrom
mvo5 wants to merge 24 commits intoosbuild:mainfrom
Conversation
4943958 to
a68c75a
Compare
1ec1ce2 to
af83333
Compare
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.
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.
af83333 to
cbe2994
Compare
5cea429 to
b9cf68f
Compare
This is a behavior change, traditionally we hardcoded xfs for filesystem customizations.
This commit moves the mount point and custom directory and file policies from the bootc-image-builder repository into "images".
2ee5b66 to
0d16cf6
Compare
3b130c6 to
382e17c
Compare
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
Contributor
Author
|
Closing in favor of #1736 - I think we wan to get back to this one but as a second step. |
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[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:
and that can then be passed to manifestgen.
/jira-epic HMS-8839
JIRA: HMS-8844