Skip to content

Commit

Permalink
rhel10: convert os package sets to image specs
Browse files Browse the repository at this point in the history
This commit moves all os pipeline packages in the new spec format.
There should be no functional changes in images.
  • Loading branch information
ondrejbudai committed Dec 12, 2024
1 parent 1adc566 commit d6a41a1
Show file tree
Hide file tree
Showing 38 changed files with 589 additions and 480 deletions.
35 changes: 35 additions & 0 deletions pkg/distro/rhel/imagetype.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package rhel

import (
"bytes"
"fmt"
"math/rand"

Expand All @@ -18,6 +19,9 @@ import (
"github.com/osbuild/images/pkg/osbuild"
"github.com/osbuild/images/pkg/platform"
"github.com/osbuild/images/pkg/rpmmd"
"github.com/osbuild/images/pkg/spec"
"github.com/osbuild/images/specs"
"gopkg.in/yaml.v3"
)

const (
Expand Down Expand Up @@ -284,6 +288,37 @@ func (t *ImageType) Manifest(bp *blueprint.Blueprint,
staticPackageSets[name] = getter(t)
}

var itSpec struct {
Spec struct {
Packages []string `yaml:"packages"`
ExcludePackages []string `yaml:"exclude_packages"`
} `yaml:"spec"`
}

configFile, err := spec.FindBestConfig(specs.Data, t.arch.Distro().Name(), t.Arch().Name(), t.Name())
if err != nil {
return nil, nil, fmt.Errorf("failed to find image type spec: %w", err)
}

rawSpec, err := spec.MergeConfig(specs.Data, configFile)
if err != nil {
return nil, nil, fmt.Errorf("failed to merge image type spec: %w", err)
}

decoder := yaml.NewDecoder(bytes.NewReader(rawSpec))
decoder.KnownFields(true)

if err := decoder.Decode(&itSpec); err != nil {
return nil, nil, fmt.Errorf("failed to unmarshal image type spec: %w", err)
}

if len(itSpec.Spec.Packages) > 0 {
staticPackageSets[OSPkgsKey] = rpmmd.PackageSet{
Include: itSpec.Spec.Packages,
Exclude: itSpec.Spec.ExcludePackages,
}
}

// amend with repository information and collect payload repos
payloadRepos := make([]rpmmd.RepoConfig, 0)
for _, repo := range repos {
Expand Down
71 changes: 3 additions & 68 deletions pkg/distro/rhel/rhel10/ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,80 +293,15 @@ func defaultEc2ImageConfigX86_64() *distro.ImageConfig {
// PACKAGE SETS

func ec2PackageSet(t *rhel.ImageType) rpmmd.PackageSet {
ps := rpmmd.PackageSet{
Include: []string{
"@core",
"chrony",
"cloud-init",
"cloud-utils-growpart",
"dhcpcd",
"yum-utils",
"dracut-config-generic",
"grub2",
"langpacks-en",
"NetworkManager-cloud-setup",
"redhat-release",
"redhat-release-eula",
"rsync",
"tuned",
"tar",
},
Exclude: []string{
"aic94xx-firmware",
"alsa-firmware",
"alsa-tools-firmware",
"biosdevname",
"firewalld",
"iprutils",
"ivtv-firmware",
"iwl1000-firmware",
"iwl100-firmware",
"iwl105-firmware",
"iwl135-firmware",
"iwl2000-firmware",
"iwl2030-firmware",
"iwl3160-firmware",
"iwl3945-firmware",
"iwl4965-firmware",
"iwl5000-firmware",
"iwl5150-firmware",
"iwl6000-firmware",
"iwl6000g2a-firmware",
"iwl6000g2b-firmware",
"iwl6050-firmware",
"iwl7260-firmware",
"libertas-sd8686-firmware",
"libertas-sd8787-firmware",
"libertas-usb8388-firmware",
"plymouth",
// RHBZ#2064087
"dracut-config-rescue",
// RHBZ#2075815
"qemu-guest-agent",
},
}.Append(distroSpecificPackageSet(t))

return ps
return rpmmd.PackageSet{}
}

// rhel-ha-ec2 image package set
func rhelEc2HaPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
ec2HaPackageSet := ec2PackageSet(t)
ec2HaPackageSet = ec2HaPackageSet.Append(rpmmd.PackageSet{
Include: []string{
"fence-agents-all",
"pacemaker",
"pcs",
},
})
return ec2HaPackageSet
return rpmmd.PackageSet{}
}

// rhel-sap-ec2 image package set
func rhelEc2SapPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
return rpmmd.PackageSet{
Include: []string{
//"libcanberra-gtk2", // libcanberra-gtk2 is not available in RHEL-10
},
}.Append(ec2PackageSet(t)).Append(SapPackageSet(t))
return rpmmd.PackageSet{}
}
78 changes: 2 additions & 76 deletions pkg/distro/rhel/rhel10/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,86 +88,12 @@ func mkAzureSapInternalImgType(rd *rhel.Distribution) *rhel.ImageType {

// Common Azure image package set
func azureCommonPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
ps := rpmmd.PackageSet{
Include: []string{
"@Server",
"bzip2",
"cloud-init",
"cloud-utils-growpart",
"dracut-config-generic",
"efibootmgr",
"hyperv-daemons",
"kernel-core",
"kernel-modules",
"kernel",
"langpacks-en",
"lvm2",
"NetworkManager",
"NetworkManager-cloud-setup",
"nvme-cli",
"patch",
"rng-tools",
"selinux-policy-targeted",
"uuid",
"WALinuxAgent",
"yum-utils",
},
Exclude: []string{
"aic94xx-firmware",
"alsa-firmware",
"alsa-lib",
"alsa-sof-firmware",
"alsa-tools-firmware",
"biosdevname",
"bolt",
"buildah",
"cockpit-podman",
"containernetworking-plugins",
"dnf-plugin-spacewalk",
"dracut-config-rescue",
"glibc-all-langpacks",
"iprutils",
"ivtv-firmware",
"iwl100-firmware",
"iwl1000-firmware",
"iwl105-firmware",
"iwl135-firmware",
"iwl2000-firmware",
"iwl2030-firmware",
"iwl3160-firmware",
"iwl3945-firmware",
"iwl4965-firmware",
"iwl5000-firmware",
"iwl5150-firmware",
"iwl6000-firmware",
"iwl6000g2a-firmware",
"iwl6000g2b-firmware",
"iwl6050-firmware",
"iwl7260-firmware",
"libertas-sd8686-firmware",
"libertas-sd8787-firmware",
"libertas-usb8388-firmware",
"NetworkManager-config-server",
"plymouth",
"podman",
"python3-dnf-plugin-spacewalk",
"python3-hwdata",
"python3-rhnlib",
"rhn-check",
"rhn-client-tools",
"rhn-setup",
"rhnlib",
"rhnsd",
"usb_modeswitch",
},
}.Append(distroSpecificPackageSet(t))

return ps
return rpmmd.PackageSet{}
}

// Azure BYOS image package set
func azurePackageSet(t *rhel.ImageType) rpmmd.PackageSet {
return azureCommonPackageSet(t)
return rpmmd.PackageSet{}
}

// Azure SAP image package set
Expand Down
61 changes: 2 additions & 59 deletions pkg/distro/rhel/rhel10/bare_metal.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ func mkTarImgType() *rhel.ImageType {
"root.tar.xz",
"application/x-tar",
map[string]rhel.PackageSetFunc{
rhel.OSPkgsKey: func(t *rhel.ImageType) rpmmd.PackageSet {
return rpmmd.PackageSet{
Include: []string{"policycoreutils", "selinux-policy-targeted"},
Exclude: []string{"rng-tools"},
}
},
rhel.OSPkgsKey: func(t *rhel.ImageType) rpmmd.PackageSet { return rpmmd.PackageSet{} },
},
rhel.TarImage,
[]string{"build"},
Expand Down Expand Up @@ -66,59 +61,7 @@ func mkImageInstallerImgType() *rhel.ImageType {
// PACKAGE SETS

func bareMetalPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
ps := rpmmd.PackageSet{
Include: []string{
"@core",
"chrony",
"cockpit-system",
"cockpit-ws",
"dnf-utils",
"dosfstools",
"firewalld",
"iwl1000-firmware",
"iwl100-firmware",
"iwl105-firmware",
"iwl135-firmware",
"iwl2000-firmware",
"iwl2030-firmware",
"iwl3160-firmware",
"iwl5000-firmware",
"iwl5150-firmware",
"iwl6000g2a-firmware",
"iwl6000g2b-firmware",
"iwl6050-firmware",
"iwl7260-firmware",
"lvm2",
"net-tools",
"nfs-utils",
"oddjob",
"oddjob-mkhomedir",
"policycoreutils",
"psmisc",
"python3-jsonschema",
"qemu-guest-agent",
"redhat-release",
"redhat-release-eula",
"rsync",
"tar",
"tcpdump",
"tuned",
},
Exclude: []string{
"dracut-config-rescue",
},
}.Append(distroBuildPackageSet(t))

// Ensure to not pull in subscription-manager on non-RHEL distro
if t.IsRHEL() {
ps = ps.Append(rpmmd.PackageSet{
Include: []string{
"subscription-manager-cockpit",
},
})
}

return ps
return rpmmd.PackageSet{}
}

func installerPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
Expand Down
82 changes: 1 addition & 81 deletions pkg/distro/rhel/rhel10/gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,87 +139,7 @@ func baseGCEImageConfig() *distro.ImageConfig {
}

func gceCommonPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
ps := rpmmd.PackageSet{
Include: []string{
"@core",
"langpacks-en", // not in Google's KS
"acpid",
"dnf-automatic",
"net-tools",
"python3",
"rng-tools",
"tar",
"vim",

// GCE guest tools
// TODO: uncomment once the package is available
// the el9 version depends on libboost_regex.so.1.75.0()(64bit), which is not available on el10
//"google-compute-engine",
"google-osconfig-agent",
// Requires gdisk which was removed late in the RHEL 10 development cycle
// "gce-disk-expand",
// cloud-init is a replacement for "google-compute-engine", remove once the package is available
"cloud-init",

// Not explicitly included in GCP kickstart, but present on the image
// for time synchronization
"chrony",
"timedatex",
// EFI
"grub2-tools",
"grub2-tools-minimal",
// Performance tuning
"tuned",
},
Exclude: []string{
"alsa-utils",
"b43-fwcutter",
"dmraid",
"dracut-config-rescue",
"eject",
"gpm",
"irqbalance",
"microcode_ctl",
"smartmontools",
"aic94xx-firmware",
"atmel-firmware",
"b43-openfwwf",
"bfa-firmware",
"ipw2100-firmware",
"ipw2200-firmware",
"ivtv-firmware",
"iwl100-firmware",
"iwl105-firmware",
"iwl135-firmware",
"iwl1000-firmware",
"iwl2000-firmware",
"iwl2030-firmware",
"iwl3160-firmware",
"iwl3945-firmware",
"iwl4965-firmware",
"iwl5000-firmware",
"iwl5150-firmware",
"iwl6000-firmware",
"iwl6000g2a-firmware",
"iwl6050-firmware",
"iwl7260-firmware",
"kernel-firmware",
"libertas-usb8388-firmware",
"ql2100-firmware",
"ql2200-firmware",
"ql23xx-firmware",
"ql2400-firmware",
"ql2500-firmware",
"rt61pci-firmware",
"rt73usb-firmware",
"xorg-x11-drv-ati-firmware",
"zd1211-firmware",
// RHBZ#2075815
"qemu-guest-agent",
},
}.Append(distroSpecificPackageSet(t))

return ps
return rpmmd.PackageSet{}
}

// GCE image
Expand Down
Loading

0 comments on commit d6a41a1

Please sign in to comment.