Skip to content

Commit

Permalink
fedora: image type names follow variants
Browse files Browse the repository at this point in the history
Fedora consists of many variants. Historically we haven't really based
our own definitions on anything. Let's introduce variant name prefixes
to all Fedora image types to indicate what variant they are based on.

The next commit will then make these variants similar to (or equal to)
the Fedora variants as they are supposed to be.

We keep the old image type names around as aliases since changing them
is a breaking change. We should however consider deprecating them and
emitting a warning for some time.

Signed-off-by: Simon de Vlieger <[email protected]>
  • Loading branch information
supakeen committed Feb 18, 2025
1 parent ba6d7a7 commit 9a00b55
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 133 deletions.
6 changes: 3 additions & 3 deletions pkg/distro/distro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,12 +541,12 @@ func TestDistro_ManifestFIPSWarning(t *testing.T) {
"edge-simplified-installer",
"edge-qcow2-image",
"iot-installer",
"iot-raw-image",
"iot-raw-xz",
"iot-simplified-installer",
"iot-qcow2-image",
"iot-qcow2",
}
noCustomizableImages := []string{
"live-installer",
"workstation-live-installer",
"azure-eap7-rhui",
}

Expand Down
13 changes: 6 additions & 7 deletions pkg/distro/distro_test_common/distro_test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func isOSTree(imgType distro.ImageType) bool {
}

func isUbi(imgType distro.ImageType) bool {
return imgType.Name() == "wsl"
return imgType.Name() == "wsl" || imgType.Name() == "server-wsl"
}

var knownKernels = []string{"kernel", "kernel-debug", "kernel-rt"}
Expand Down Expand Up @@ -84,8 +84,8 @@ func TestDistro_KernelOption(t *testing.T, d distro.Distro) {
"edge-simplified-installer": true,
"edge-vsphere": true,
"iot-installer": true,
"iot-qcow2-image": true,
"iot-raw-image": true,
"iot-qcow2": true,
"iot-raw-xz": true,
"iot-simplified-installer": true,

// the tar image type is a minimal image type which is not expected to
Expand All @@ -98,8 +98,9 @@ func TestDistro_KernelOption(t *testing.T, d distro.Distro) {
// image installer on Fedora doesn't support kernel customizations
// on RHEL we support kernel name
// TODO: Remove when we unify the allowed options
"image-installer": true,
"live-installer": true,
"image-installer": true,
"minimal-installer": true,
"workstation-live-installer": true,
}

{ // empty blueprint: all image types should just have the default kernel
Expand Down Expand Up @@ -184,8 +185,6 @@ func TestDistro_OSTreeOptions(t *testing.T, d distro.Distro) {
"edge-simplified-installer": true,
"iot-ami": true,
"iot-installer": true,
"iot-qcow2-image": true,
"iot-raw-image": true,
"iot-simplified-installer": true,
}

Expand Down
54 changes: 32 additions & 22 deletions pkg/distro/fedora/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ var (

// Image Definitions
imageInstallerImgType = imageType{
name: "image-installer",
nameAliases: []string{"fedora-image-installer"},
name: "minimal-installer",
nameAliases: []string{"image-installer", "fedora-image-installer"},
filename: "installer.iso",
mimeType: "application/x-iso9660-image",
packageSets: map[string]packageSetFunc{
osPkgsKey: func(t *imageType) rpmmd.PackageSet {
// use the minimal raw image type for the OS package set
ft := &imageType{
name: "minimal-raw",
name: "minimal-raw-xz",
arch: t.arch,
}
return packagesets.Load(ft, VersionReplacements())
Expand All @@ -117,8 +117,8 @@ var (
}

liveInstallerImgType = imageType{
name: "live-installer",
nameAliases: []string{},
name: "workstation-live-installer",
nameAliases: []string{"live-installer"},
filename: "live-installer.iso",
mimeType: "application/x-iso9660-image",
packageSets: map[string]packageSetFunc{
Expand Down Expand Up @@ -251,7 +251,7 @@ var (
}

iotRawImgType = imageType{
name: "iot-raw-image",
name: "iot-raw-xz",
nameAliases: []string{"fedora-iot-raw-image"},
filename: "image.raw.xz",
compression: "xz",
Expand Down Expand Up @@ -283,7 +283,8 @@ var (
}

iotQcow2ImgType = imageType{
name: "iot-qcow2-image",
name: "iot-qcow2",
nameAliases: []string{"iot-qcow2-image"}, // kept for backwards compatibility
filename: "image.qcow2",
mimeType: "application/x-qemu-disk",
packageSets: map[string]packageSetFunc{},
Expand All @@ -309,7 +310,8 @@ var (
}

qcow2ImgType = imageType{
name: "qcow2",
name: "server-qcow2",
nameAliases: []string{"qcow2"}, // kept for backwards compatibility
filename: "disk.qcow2",
mimeType: "application/x-qemu-disk",
environment: &environment.KVM{},
Expand Down Expand Up @@ -341,9 +343,10 @@ var (
}

vmdkImgType = imageType{
name: "vmdk",
filename: "disk.vmdk",
mimeType: "application/x-vmdk",
name: "server-vmdk",
nameAliases: []string{"vmdk"}, // kept for backwards compatibility
filename: "disk.vmdk",
mimeType: "application/x-vmdk",
packageSets: map[string]packageSetFunc{
osPkgsKey: packageSetLoader,
},
Expand All @@ -360,9 +363,10 @@ var (
}

ovaImgType = imageType{
name: "ova",
filename: "image.ova",
mimeType: "application/ovf",
name: "server-ova",
nameAliases: []string{"ova"}, // kept for backwards compatibility
filename: "image.ova",
mimeType: "application/ovf",
packageSets: map[string]packageSetFunc{
osPkgsKey: packageSetLoader,
},
Expand Down Expand Up @@ -400,9 +404,10 @@ var (
}

wslImgType = imageType{
name: "wsl",
filename: "wsl.tar",
mimeType: "application/x-tar",
name: "server-wsl",
nameAliases: []string{"wsl"}, // kept for backwards compatibility
filename: "wsl.tar",
mimeType: "application/x-tar",
packageSets: map[string]packageSetFunc{
osPkgsKey: packageSetLoader,
},
Expand All @@ -426,7 +431,8 @@ var (
}

minimalrawImgType = imageType{
name: "minimal-raw",
name: "minimal-raw-xz",
nameAliases: []string{"minimal-raw"}, // kept for backwards compatibility
filename: "disk.raw.xz",
compression: "xz",
mimeType: "application/xz",
Expand Down Expand Up @@ -647,21 +653,25 @@ func newDistro(version int) distro.Distro {
}

ociImgType := qcow2ImgType
ociImgType.name = "oci"
ociImgType.name = "server-oci"
ociImgType.nameAliases = []string{"oci"} // kept for backwards compatibility

amiImgType := qcow2ImgType
amiImgType.name = "ami"
amiImgType.name = "server-ami"
amiImgType.nameAliases = []string{"ami"} // kept for backwards compatibility
amiImgType.filename = "image.raw"
amiImgType.mimeType = "application/octet-stream"
amiImgType.payloadPipelines = []string{"os", "image"}
amiImgType.exports = []string{"image"}
amiImgType.environment = &environment.EC2{}

openstackImgType := qcow2ImgType
openstackImgType.name = "openstack"
openstackImgType.name = "server-openstack"
openstackImgType.nameAliases = []string{"openstack"} // kept for backwards compatibility

vhdImgType := qcow2ImgType
vhdImgType.name = "vhd"
vhdImgType.name = "server-vhd"
vhdImgType.nameAliases = []string{"vhd"} // kept for backwards compatibility
vhdImgType.filename = "disk.vhd"
vhdImgType.mimeType = "application/x-vhd"
vhdImgType.payloadPipelines = []string{"os", "image", "vpc"}
Expand Down
Loading

0 comments on commit 9a00b55

Please sign in to comment.