From c6843db6b43c7f293b9ed36886b06ea1e3ecde2e Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Tue, 16 Aug 2022 21:15:13 +0200 Subject: [PATCH] fedora: add the iot-raw-image to x86 and aarch64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the new image type to the list in each architecture and update tests. Ignore ostree raw images in Kernel count test in distro_test_common: Edge and IoT raw images don't need a kernel specified in their OS pipeline. The kernel (and the OS in general, including all packages) come from the commit that is pulled and deployed in the image. This test passes on RHEL (for edge-raw-image types) because the blueprint defaults to returning the main kernel, but this isn't necessary and is likely to change in the near future. Co-Authored-By: Ondřej Budai --- .../distro/distro_test_common/distro_test_common.go | 4 ++-- internal/distro/fedora/distro.go | 4 +++- internal/distro/fedora/distro_test.go | 12 ++++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/internal/distro/distro_test_common/distro_test_common.go b/internal/distro/distro_test_common/distro_test_common.go index c7872eeb0..a6ebf6fc8 100644 --- a/internal/distro/distro_test_common/distro_test_common.go +++ b/internal/distro/distro_test_common/distro_test_common.go @@ -226,8 +226,8 @@ func TestDistro_KernelOption(t *testing.T, d distro.Distro) { imgType, err := arch.GetImageType(typeName) assert.NoError(t, err) nk := kernelCount(imgType) - // No kernel packages in containers - if strings.HasSuffix(typeName, "container") { + // No kernel packages in containers and edge/iot images + if strings.HasSuffix(typeName, "container") || strings.HasSuffix(typeName, "edge-raw-image") || strings.HasSuffix(typeName, "iot-raw-image") { continue } // at least one kernel for general image types diff --git a/internal/distro/fedora/distro.go b/internal/distro/fedora/distro.go index 98daba6f2..fbca7b6f5 100644 --- a/internal/distro/fedora/distro.go +++ b/internal/distro/fedora/distro.go @@ -131,7 +131,7 @@ var ( exports: []string{"bootiso"}, } - _ = imageType{ + iotRawImgType = imageType{ name: "fedora-iot-raw-image", nameAliases: []string{"iot-raw-image"}, filename: "image.raw.xz", @@ -854,6 +854,7 @@ func newDistro(version int) distro.Distro { iotOCIImgType, iotCommitImgType, iotInstallerImgType, + iotRawImgType, ) aarch64.addImageTypes( &platform.Aarch64{ @@ -902,6 +903,7 @@ func newDistro(version int) distro.Distro { iotCommitImgType, iotOCIImgType, iotInstallerImgType, + iotRawImgType, ) s390x.addImageTypes(nil) diff --git a/internal/distro/fedora/distro_test.go b/internal/distro/fedora/distro_test.go index 02cd376f6..c9fa97fdc 100644 --- a/internal/distro/fedora/distro_test.go +++ b/internal/distro/fedora/distro_test.go @@ -277,6 +277,7 @@ func TestImageType_Name(t *testing.T) { "fedora-iot-commit", "fedora-iot-container", "fedora-iot-installer", + "fedora-iot-raw-image", "oci", }, }, @@ -290,6 +291,7 @@ func TestImageType_Name(t *testing.T) { "fedora-iot-commit", "fedora-iot-container", "fedora-iot-installer", + "fedora-iot-raw-image", }, }, } @@ -445,6 +447,7 @@ func TestArchitecture_ListImageTypes(t *testing.T) { "fedora-iot-commit", "fedora-iot-container", "fedora-iot-installer", + "fedora-iot-raw-image", "oci", "container", }, @@ -458,6 +461,7 @@ func TestArchitecture_ListImageTypes(t *testing.T) { "fedora-iot-commit", "fedora-iot-container", "fedora-iot-installer", + "fedora-iot-raw-image", "oci", "container", }, @@ -551,7 +555,7 @@ func TestDistro_CustomFileSystemManifestError(t *testing.T) { for _, imgTypeName := range arch.ListImageTypes() { imgType, _ := arch.GetImageType(imgTypeName) _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0) - if imgTypeName == "fedora-iot-commit" || imgTypeName == "fedora-iot-container" { + if imgTypeName == "fedora-iot-commit" || imgTypeName == "fedora-iot-container" || imgTypeName == "fedora-iot-raw-image" { assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types") } else if imgTypeName == "fedora-iot-installer" { continue @@ -580,7 +584,7 @@ func TestDistro_TestRootMountPoint(t *testing.T) { imgType, _ := arch.GetImageType(imgTypeName) testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType) _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0) - if imgTypeName == "fedora-iot-commit" || imgTypeName == "fedora-iot-container" { + if imgTypeName == "fedora-iot-commit" || imgTypeName == "fedora-iot-container" || imgTypeName == "fedora-iot-raw-image" { assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types") } else if imgTypeName == "fedora-iot-installer" { continue @@ -716,7 +720,7 @@ func TestDistro_CustomFileSystemPatternMatching(t *testing.T) { for _, imgTypeName := range arch.ListImageTypes() { imgType, _ := arch.GetImageType(imgTypeName) _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0) - if imgTypeName == "fedora-iot-commit" || imgTypeName == "fedora-iot-container" { + if imgTypeName == "fedora-iot-commit" || imgTypeName == "fedora-iot-container" || imgTypeName == "fedora-iot-raw-image" { assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types") } else if imgTypeName == "fedora-iot-installer" { continue @@ -745,7 +749,7 @@ func TestDistro_CustomUsrPartitionNotLargeEnough(t *testing.T) { imgType, _ := arch.GetImageType(imgTypeName) testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType) _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0) - if imgTypeName == "fedora-iot-commit" || imgTypeName == "fedora-iot-container" { + if imgTypeName == "fedora-iot-commit" || imgTypeName == "fedora-iot-container" || imgTypeName == "fedora-iot-raw-image" { assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types") } else if imgTypeName == "fedora-iot-installer" { continue