Update osbuild/images to v0.56.0

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-04-23 09:09:17 +02:00 committed by Achilleas Koutsou
parent 3df0c3a631
commit 5028a8c99d
159 changed files with 13207 additions and 3630 deletions

View file

@ -42,6 +42,12 @@ type AnacondaContainerInstaller struct {
AdditionalAnacondaModules []string
AdditionalDrivers []string
FIPS bool
// Kernel options that will be apended to the installed system
// (not the iso)
KickstartKernelOptionsAppend []string
// Enable networking on on boot in the installed system
KickstartNetworkOnBoot bool
}
func NewAnacondaContainerInstaller(container container.SourceSpec, ref string) *AnacondaContainerInstaller {
@ -114,6 +120,9 @@ func (img *AnacondaContainerInstaller) InstantiateManifest(m *manifest.Manifest,
isoTreePipeline.OSName = img.OSName
isoTreePipeline.Users = img.Users
isoTreePipeline.Groups = img.Groups
isoTreePipeline.KickstartKernelOptionsAppend = img.KickstartKernelOptionsAppend
isoTreePipeline.KickstartNetworkOnBoot = img.KickstartNetworkOnBoot
isoTreePipeline.SquashfsCompression = img.SquashfsCompression

View file

@ -26,11 +26,14 @@ type BootcDiskImage struct {
// Customizations
KernelOptionsAppend []string
// "Users" is a bit misleading as only root and its ssh key is supported
// right now because that is all that bootc gives us by default but that
// will most likely change over time.
// See https://github.com/containers/bootc/pull/267
Users []users.User
// The users to put into the image, note that /etc/paswd (and friends)
// will become unmanaged state by bootc when used
Users []users.User
Groups []users.Group
// SELinux policy, when set it enables the labeling of the tree with the
// selected profile
SELinux string
}
func NewBootcDiskImage(container container.SourceSpec) *BootcDiskImage {
@ -52,24 +55,24 @@ func (img *BootcDiskImage) InstantiateManifestFromContainers(m *manifest.Manifes
// this is signified by passing nil to the below pipelines.
var hostPipeline manifest.Build
// TODO: no support for customization right now but minimal support
// for root ssh keys is supported
baseImage := manifest.NewRawBootcImage(buildPipeline, containers, img.Platform)
baseImage.PartitionTable = img.PartitionTable
baseImage.Users = img.Users
baseImage.KernelOptionsAppend = img.KernelOptionsAppend
rawImage := manifest.NewRawBootcImage(buildPipeline, containers, img.Platform)
rawImage.PartitionTable = img.PartitionTable
rawImage.Users = img.Users
rawImage.Groups = img.Groups
rawImage.KernelOptionsAppend = img.KernelOptionsAppend
rawImage.SELinux = img.SELinux
// In BIB, we export multiple images from the same pipeline so we use the
// filename as the basename for each export and set the extensions based on
// each file format.
fileBasename := img.Filename
baseImage.SetFilename(fmt.Sprintf("%s.raw", fileBasename))
rawImage.SetFilename(fmt.Sprintf("%s.raw", fileBasename))
qcow2Pipeline := manifest.NewQCOW2(hostPipeline, baseImage)
qcow2Pipeline := manifest.NewQCOW2(hostPipeline, rawImage)
qcow2Pipeline.Compat = img.Platform.GetQCOW2Compat()
qcow2Pipeline.SetFilename(fmt.Sprintf("%s.qcow2", fileBasename))
vmdkPipeline := manifest.NewVMDK(hostPipeline, baseImage)
vmdkPipeline := manifest.NewVMDK(hostPipeline, rawImage)
vmdkPipeline.SetFilename(fmt.Sprintf("%s.vmdk", fileBasename))
ovfPipeline := manifest.NewOVF(hostPipeline, vmdkPipeline)

View file

@ -0,0 +1,86 @@
package image
import (
"fmt"
"math/rand"
"github.com/osbuild/images/pkg/container"
"github.com/osbuild/images/pkg/manifest"
"github.com/osbuild/images/pkg/osbuild"
"github.com/osbuild/images/pkg/runner"
)
// Legacy pipeline to create bootc images. This can be removed once
//
// https://github.com/containers/bootc/pull/462
//
// or
//
// https://www.mail-archive.com/qemu-devel@nongnu.org/msg1034508.html
//
// is available everyhwere
type BootcLegacyDiskImage struct {
bootcImg *BootcDiskImage
}
func NewBootcLegacyDiskImage(real *BootcDiskImage) *BootcLegacyDiskImage {
return &BootcLegacyDiskImage{
bootcImg: real,
}
}
func (img *BootcLegacyDiskImage) InstantiateManifestFromContainers(m *manifest.Manifest,
containers []container.SourceSpec,
runner runner.Runner,
rng *rand.Rand) error {
// XXX: hardcoded for now
ref := "ostree/1/1/0"
ostreeImg := &OSTreeDiskImage{
Base: NewBase("bootc-raw-image"),
ContainerSource: img.bootcImg.ContainerSource,
Ref: ref,
OSName: "default",
}
ostreeImg.Platform = img.bootcImg.Platform
ostreeImg.PartitionTable = img.bootcImg.PartitionTable
ostreeImg.OSTreeDeploymentCustomizations.KernelOptionsAppend = img.bootcImg.KernelOptionsAppend
ostreeImg.OSTreeDeploymentCustomizations.Users = img.bootcImg.Users
ostreeImg.OSTreeDeploymentCustomizations.Groups = img.bootcImg.Groups
buildPipeline := manifest.NewBuildFromContainer(m, runner, containers, &manifest.BuildOptions{ContainerBuildable: true})
buildPipeline.Checkpoint()
// In the bootc flow, we reuse the host container context for tools;
// this is signified by passing nil to the below pipelines.
var hostPipeline manifest.Build
opts := &baseRawOstreeImageOpts{useBootupd: true}
fileBasename := img.bootcImg.Filename
// In BIB, we export multiple images from the same pipeline so we use the
// filename as the basename for each export and set the extensions based on
// each file format.
baseImage := baseRawOstreeImage(ostreeImg, buildPipeline, opts)
baseImage.SetFilename(fmt.Sprintf("%s.raw", fileBasename))
qcow2Pipeline := manifest.NewQCOW2(hostPipeline, baseImage)
qcow2Pipeline.Compat = ostreeImg.Platform.GetQCOW2Compat()
qcow2Pipeline.SetFilename(fmt.Sprintf("%s.qcow2", fileBasename))
vmdkPipeline := manifest.NewVMDK(hostPipeline, baseImage)
vmdkPipeline.SetFilename(fmt.Sprintf("%s.vmdk", fileBasename))
ovfPipeline := manifest.NewOVF(hostPipeline, vmdkPipeline)
tarPipeline := manifest.NewTar(hostPipeline, ovfPipeline, "archive")
tarPipeline.Format = osbuild.TarArchiveFormatUstar
tarPipeline.SetFilename(fmt.Sprintf("%s.tar", fileBasename))
// The .ovf descriptor needs to be the first file in the archive
tarPipeline.Paths = []string{
fmt.Sprintf("%s.ovf", fileBasename),
fmt.Sprintf("%s.mf", fileBasename),
fmt.Sprintf("%s.vmdk", fileBasename),
}
return nil
}

View file

@ -27,8 +27,10 @@ type DiskImage struct {
Workload workload.Workload
Filename string
Compression string
ForceSize *bool
PartTool osbuild.PartTool
// Control the VPC subformat use of force_size
VPCForceSize *bool
PartTool osbuild.PartTool
NoBLS bool
OSProduct string
@ -59,7 +61,6 @@ func (img *DiskImage) InstantiateManifest(m *manifest.Manifest,
osPipeline.OSCustomizations = img.OSCustomizations
osPipeline.Environment = img.Environment
osPipeline.Workload = img.Workload
osPipeline.NoBLS = img.NoBLS
osPipeline.OSProduct = img.OSProduct
osPipeline.OSVersion = img.OSVersion
osPipeline.OSNick = img.OSNick
@ -80,7 +81,7 @@ func (img *DiskImage) InstantiateManifest(m *manifest.Manifest,
imagePipeline = qcow2Pipeline
case platform.FORMAT_VHD:
vpcPipeline := manifest.NewVPC(buildPipeline, rawImagePipeline)
vpcPipeline.ForceSize = img.ForceSize
vpcPipeline.ForceSize = img.VPCForceSize
imagePipeline = vpcPipeline
case platform.FORMAT_VMDK:
imagePipeline = manifest.NewVMDK(buildPipeline, rawImagePipeline)