From e1ebb55d0abd498f901ea89a907c64de29ca7eca Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Tue, 10 Jan 2023 17:05:04 +0100 Subject: [PATCH] distro/rhel8: update ami and ec2 images to new definitions --- internal/distro/rhel8/ami.go | 74 +++++++++++++++--------------- internal/distro/rhel8/pipelines.go | 42 ----------------- 2 files changed, 36 insertions(+), 80 deletions(-) diff --git a/internal/distro/rhel8/ami.go b/internal/distro/rhel8/ami.go index b167be015..36d36a20a 100644 --- a/internal/distro/rhel8/ami.go +++ b/internal/distro/rhel8/ami.go @@ -13,8 +13,7 @@ func amiImgTypeX86_64(rd distribution) imageType { filename: "image.raw", mimeType: "application/octet-stream", packageSets: map[string]packageSetFunc{ - buildPkgsKey: ec2BuildPackageSet, - osPkgsKey: ec2CommonPackageSet, + osPkgsKey: ec2CommonPackageSet, }, packageSetChains: map[string][]string{ osPkgsKey: {osPkgsKey, blueprintPkgsKey}, @@ -24,7 +23,7 @@ func amiImgTypeX86_64(rd distribution) imageType { bootable: true, bootType: distro.LegacyBootType, defaultSize: 10 * common.GibiByte, - pipelines: ec2Pipelines, + image: liveImage, buildPipelines: []string{"build"}, payloadPipelines: []string{"os", "image"}, exports: []string{"image"}, @@ -36,12 +35,12 @@ func amiImgTypeX86_64(rd distribution) imageType { func ec2ImgTypeX86_64(rd distribution) imageType { it := imageType{ - name: "ec2", - filename: "image.raw.xz", - mimeType: "application/xz", + name: "ec2", + filename: "image.raw.xz", + mimeType: "application/xz", + compression: "xz", packageSets: map[string]packageSetFunc{ - buildPkgsKey: ec2BuildPackageSet, - osPkgsKey: rhelEc2PackageSet, + osPkgsKey: rhelEc2PackageSet, }, packageSetChains: map[string][]string{ osPkgsKey: {osPkgsKey, blueprintPkgsKey}, @@ -51,10 +50,10 @@ func ec2ImgTypeX86_64(rd distribution) imageType { bootable: true, bootType: distro.LegacyBootType, defaultSize: 10 * common.GibiByte, - pipelines: rhelEc2Pipelines, + image: liveImage, buildPipelines: []string{"build"}, - payloadPipelines: []string{"os", "image", "archive"}, - exports: []string{"archive"}, + payloadPipelines: []string{"os", "image", "xz"}, + exports: []string{"xz"}, basePartitionTables: ec2BasePartitionTables, } return it @@ -62,12 +61,12 @@ func ec2ImgTypeX86_64(rd distribution) imageType { func ec2HaImgTypeX86_64(rd distribution) imageType { it := imageType{ - name: "ec2-ha", - filename: "image.raw.xz", - mimeType: "application/xz", + name: "ec2-ha", + filename: "image.raw.xz", + mimeType: "application/xz", + compression: "xz", packageSets: map[string]packageSetFunc{ - buildPkgsKey: ec2BuildPackageSet, - osPkgsKey: rhelEc2HaPackageSet, + osPkgsKey: rhelEc2HaPackageSet, }, packageSetChains: map[string][]string{ osPkgsKey: {osPkgsKey, blueprintPkgsKey}, @@ -77,10 +76,10 @@ func ec2HaImgTypeX86_64(rd distribution) imageType { bootable: true, bootType: distro.LegacyBootType, defaultSize: 10 * common.GibiByte, - pipelines: rhelEc2Pipelines, + image: liveImage, buildPipelines: []string{"build"}, - payloadPipelines: []string{"os", "image", "archive"}, - exports: []string{"archive"}, + payloadPipelines: []string{"os", "image", "xz"}, + exports: []string{"xz"}, basePartitionTables: ec2BasePartitionTables, } return it @@ -92,8 +91,7 @@ func amiImgTypeAarch64(rd distribution) imageType { filename: "image.raw", mimeType: "application/octet-stream", packageSets: map[string]packageSetFunc{ - buildPkgsKey: ec2BuildPackageSet, - osPkgsKey: ec2CommonPackageSet, + osPkgsKey: ec2CommonPackageSet, }, packageSetChains: map[string][]string{ osPkgsKey: {osPkgsKey, blueprintPkgsKey}, @@ -102,7 +100,7 @@ func amiImgTypeAarch64(rd distribution) imageType { kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 iommu.strict=0 crashkernel=auto", bootable: true, defaultSize: 10 * common.GibiByte, - pipelines: ec2Pipelines, + image: liveImage, buildPipelines: []string{"build"}, payloadPipelines: []string{"os", "image"}, exports: []string{"image"}, @@ -113,12 +111,12 @@ func amiImgTypeAarch64(rd distribution) imageType { func ec2ImgTypeAarch64(rd distribution) imageType { it := imageType{ - name: "ec2", - filename: "image.raw.xz", - mimeType: "application/xz", + name: "ec2", + filename: "image.raw.xz", + mimeType: "application/xz", + compression: "xz", packageSets: map[string]packageSetFunc{ - buildPkgsKey: ec2BuildPackageSet, - osPkgsKey: rhelEc2PackageSet, + osPkgsKey: rhelEc2PackageSet, }, packageSetChains: map[string][]string{ osPkgsKey: {osPkgsKey, blueprintPkgsKey}, @@ -127,10 +125,10 @@ func ec2ImgTypeAarch64(rd distribution) imageType { kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 iommu.strict=0 crashkernel=auto", bootable: true, defaultSize: 10 * common.GibiByte, - pipelines: rhelEc2Pipelines, + image: liveImage, buildPipelines: []string{"build"}, - payloadPipelines: []string{"os", "image", "archive"}, - exports: []string{"archive"}, + payloadPipelines: []string{"os", "image", "xz"}, + exports: []string{"xz"}, basePartitionTables: ec2BasePartitionTables, } return it @@ -138,12 +136,12 @@ func ec2ImgTypeAarch64(rd distribution) imageType { func ec2SapImgTypeX86_64(rd distribution) imageType { it := imageType{ - name: "ec2-sap", - filename: "image.raw.xz", - mimeType: "application/xz", + name: "ec2-sap", + filename: "image.raw.xz", + mimeType: "application/xz", + compression: "xz", packageSets: map[string]packageSetFunc{ - buildPkgsKey: ec2BuildPackageSet, - osPkgsKey: rhelEc2SapPackageSet, + osPkgsKey: rhelEc2SapPackageSet, }, packageSetChains: map[string][]string{ osPkgsKey: {osPkgsKey, blueprintPkgsKey}, @@ -153,10 +151,10 @@ func ec2SapImgTypeX86_64(rd distribution) imageType { bootable: true, bootType: distro.LegacyBootType, defaultSize: 10 * common.GibiByte, - pipelines: rhelEc2Pipelines, + image: liveImage, buildPipelines: []string{"build"}, - payloadPipelines: []string{"os", "image", "archive"}, - exports: []string{"archive"}, + payloadPipelines: []string{"os", "image", "xz"}, + exports: []string{"xz"}, basePartitionTables: ec2BasePartitionTables, } return it diff --git a/internal/distro/rhel8/pipelines.go b/internal/distro/rhel8/pipelines.go index 4180bd295..e5e1a2461 100644 --- a/internal/distro/rhel8/pipelines.go +++ b/internal/distro/rhel8/pipelines.go @@ -56,48 +56,6 @@ func vmdkPipelines(t *imageType, customizations *blueprint.Customizations, optio return pipelines, nil } -func ec2CommonPipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, - repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, containers []container.Spec, - rng *rand.Rand, diskfile string) ([]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) - kernelVer := rpmmd.GetVerStrFromPackageSpecListPanic(packageSetSpecs[osPkgsKey], customizations.GetKernel().Name) - imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, partitionTable, t.arch, kernelVer) - pipelines = append(pipelines, *imagePipeline) - return pipelines, nil -} - -// ec2Pipelines returns pipelines which produce uncompressed EC2 images which are expected to use RHSM for content -func ec2Pipelines(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) { - return ec2CommonPipelines(t, customizations, options, repos, packageSetSpecs, containers, rng, t.Filename()) -} - -// rhelEc2Pipelines returns pipelines which produce XZ-compressed EC2 images which are expected to use RHUI for content -func rhelEc2Pipelines(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) { - rawImageFilename := "image.raw" - - pipelines, err := ec2CommonPipelines(t, customizations, options, repos, packageSetSpecs, containers, rng, rawImageFilename) - if err != nil { - return nil, err - } - - lastPipeline := pipelines[len(pipelines)-1] - pipelines = append(pipelines, *xzArchivePipeline(lastPipeline.Name, rawImageFilename, t.Filename())) - - return pipelines, nil -} - func gcePipelines(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()))