distro/rhel9: update azure images to new definitions

Add the new image function and remove the pipeline function.
Remove the build package set.
Rename the last pipeline to xz for the RHUI image type.
This commit is contained in:
Achilleas Koutsou 2022-11-25 12:03:29 +01:00 committed by Christian Kellner
parent ae37ebb286
commit 1d1523828a

View file

@ -1,11 +1,7 @@
package rhel9
import (
"math/rand"
"github.com/osbuild/osbuild-composer/internal/blueprint"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/osbuild-composer/internal/container"
"github.com/osbuild/osbuild-composer/internal/disk"
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/osbuild"
@ -19,9 +15,7 @@ var (
filename: "disk.vhd",
mimeType: "application/x-vhd",
packageSets: map[string]packageSetFunc{
// the ec2 buildroot is required due to the cloud-init stage and dependency on YAML
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: azurePackageSet,
osPkgsKey: azurePackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
@ -30,7 +24,7 @@ var (
kernelOptions: defaultAzureKernelOptions,
bootable: true,
defaultSize: 4 * common.GibiByte,
pipelines: vhdPipelines(false),
image: liveImage,
buildPipelines: []string{"build"},
payloadPipelines: []string{"os", "image", "vpc"},
exports: []string{"vpc"},
@ -43,9 +37,7 @@ var (
filename: "disk.vhd",
mimeType: "application/x-vhd",
packageSets: map[string]packageSetFunc{
// the ec2 buildroot is required due to the cloud-init stage and dependency on YAML
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: azurePackageSet,
osPkgsKey: azurePackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
@ -54,7 +46,7 @@ var (
kernelOptions: defaultAzureKernelOptions,
bootable: true,
defaultSize: 4 * common.GibiByte,
pipelines: vhdPipelines(false),
image: liveImage,
buildPipelines: []string{"build"},
payloadPipelines: []string{"os", "image", "vpc"},
exports: []string{"vpc"},
@ -63,22 +55,21 @@ var (
// Azure RHUI image type
azureRhuiImgType = imageType{
name: "azure-rhui",
filename: "disk.vhd.xz",
mimeType: "application/xz",
name: "azure-rhui",
filename: "disk.vhd.xz",
mimeType: "application/xz",
compression: "xz",
packageSets: map[string]packageSetFunc{
// the ec2 buildroot is required due to the cloud-init stage and dependency on YAML
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: azureRhuiPackageSet,
osPkgsKey: azureRhuiPackageSet,
},
defaultImageConfig: defaultAzureRhuiImageConfig.InheritFrom(defaultAzureImageConfig),
kernelOptions: defaultAzureKernelOptions,
bootable: true,
defaultSize: 64 * common.GibiByte,
pipelines: vhdPipelines(true),
image: liveImage,
buildPipelines: []string{"build"},
payloadPipelines: []string{"os", "image", "vpc", "archive"},
exports: []string{"archive"},
payloadPipelines: []string{"os", "image", "vpc", "xz"},
exports: []string{"xz"},
basePartitionTables: azureRhuiBasePartitionTables,
}
)
@ -303,50 +294,6 @@ var azureRhuiBasePartitionTables = distro.BasePartitionTableMap{
},
}
// PIPELINE GENERATORS
func vhdPipelines(compress bool) pipelinesFunc {
return func(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, containers []container.Spec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
pipelines := make([]osbuild.Pipeline, 0)
pipelines = append(pipelines, *buildPipeline(repos, packageSetSpecs[buildPkgsKey], t.arch.distro.runner.String()))
partitionTable, err := t.getPartitionTable(customizations.GetFilesystems(), options, rng)
if err != nil {
return nil, err
}
treePipeline, err := osPipeline(t, repos, packageSetSpecs[osPkgsKey], containers, customizations, options, partitionTable)
if err != nil {
return nil, err
}
pipelines = append(pipelines, *treePipeline)
diskfile := "disk.img"
kernelVer := rpmmd.GetVerStrFromPackageSpecListPanic(packageSetSpecs[osPkgsKey], customizations.GetKernel().Name)
imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, partitionTable, t.arch, kernelVer)
pipelines = append(pipelines, *imagePipeline)
var qemufile string
if compress {
qemufile = "disk.vhd"
} else {
qemufile = t.filename
}
qemuPipeline := qemuPipeline(imagePipeline.Name, diskfile, qemufile, osbuild.QEMUFormatVPC, nil)
pipelines = append(pipelines, *qemuPipeline)
if compress {
lastPipeline := pipelines[len(pipelines)-1]
pipelines = append(pipelines, *xzArchivePipeline(lastPipeline.Name, qemufile, t.Filename()))
}
return pipelines, nil
}
}
// IMAGE DEFINITIONS
var defaultAzureKernelOptions = "ro console=tty1 console=ttyS0 earlyprintk=ttyS0 rootdelay=300"
var defaultAzureImageConfig = &distro.ImageConfig{