diff --git a/internal/workload/custom.go b/internal/workload/custom.go deleted file mode 100644 index 5449a0d9fd..0000000000 --- a/internal/workload/custom.go +++ /dev/null @@ -1,32 +0,0 @@ -package workload - -type Custom struct { - BaseWorkload - Packages []string - EnabledModules []string - Services []string - DisabledServices []string - MaskedServices []string -} - -func (p *Custom) GetPackages() []string { - return p.Packages -} - -func (p *Custom) GetEnabledModules() []string { - return p.EnabledModules -} - -func (p *Custom) GetServices() []string { - return p.Services -} - -// TODO: Do these belong here? What kind of workload requires -// services to be disabled or masked? -func (p *Custom) GetDisabledServices() []string { - return p.DisabledServices -} - -func (p *Custom) GetMaskedServices() []string { - return p.MaskedServices -} diff --git a/internal/workload/workload.go b/internal/workload/workload.go deleted file mode 100644 index f6b9216a97..0000000000 --- a/internal/workload/workload.go +++ /dev/null @@ -1,40 +0,0 @@ -package workload - -import "github.com/osbuild/images/pkg/rpmmd" - -type Workload interface { - GetPackages() []string - GetEnabledModules() []string - GetRepos() []rpmmd.RepoConfig - GetServices() []string - GetDisabledServices() []string - GetMaskedServices() []string -} - -type BaseWorkload struct { - Repos []rpmmd.RepoConfig -} - -func (p BaseWorkload) GetPackages() []string { - return []string{} -} - -func (p BaseWorkload) GetEnabledModules() []string { - return []string{} -} - -func (p BaseWorkload) GetRepos() []rpmmd.RepoConfig { - return p.Repos -} - -func (p BaseWorkload) GetServices() []string { - return []string{} -} - -func (p BaseWorkload) GetDisabledServices() []string { - return []string{} -} - -func (p BaseWorkload) GetMaskedServices() []string { - return []string{} -} diff --git a/pkg/distro/generic/images.go b/pkg/distro/generic/images.go index 6940578ff0..4ab809180a 100644 --- a/pkg/distro/generic/images.go +++ b/pkg/distro/generic/images.go @@ -6,7 +6,6 @@ import ( "strings" "github.com/osbuild/blueprint/pkg/blueprint" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/container" "github.com/osbuild/images/pkg/customizations/anaconda" "github.com/osbuild/images/pkg/customizations/bootc" @@ -439,7 +438,7 @@ func ostreeDeploymentCustomizations( // IMAGES -func diskImage(workload workload.Workload, +func diskImage(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, @@ -457,7 +456,7 @@ func diskImage(workload workload.Workload, } img.Environment = &t.ImageTypeYAML.Environment - img.Workload = workload + img.ImgTypeCustomizations = imgTypeCustomizations img.Compression = t.ImageTypeYAML.Compression if bp.Minimal { // Disable weak dependencies if the 'minimal' option is enabled @@ -487,7 +486,7 @@ func diskImage(workload workload.Workload, return img, nil } -func tarImage(workload workload.Workload, +func tarImage(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, @@ -507,7 +506,7 @@ func tarImage(workload workload.Workload, d := t.arch.distro img.Environment = &t.ImageTypeYAML.Environment - img.Workload = workload + img.ImgTypeCustomizations = imgTypeCustomizations img.Compression = t.ImageTypeYAML.Compression img.OSVersion = d.OsVersion() @@ -516,7 +515,7 @@ func tarImage(workload workload.Workload, return img, nil } -func containerImage(workload workload.Workload, +func containerImage(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, @@ -534,14 +533,14 @@ func containerImage(workload workload.Workload, } img.Environment = &t.ImageTypeYAML.Environment - img.Workload = workload + img.ImgTypeCustomizations = imgTypeCustomizations img.Filename = t.Filename() return img, nil } -func liveInstallerImage(workload workload.Workload, +func liveInstallerImage(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, @@ -552,7 +551,7 @@ func liveInstallerImage(workload workload.Workload, img := image.NewAnacondaLiveInstaller() img.Platform = t.platform - img.Workload = workload + img.ImgTypeCustomizations = imgTypeCustomizations img.ExtraBasePackages = packageSets[installerPkgsKey] d := t.arch.distro @@ -585,7 +584,7 @@ func liveInstallerImage(workload workload.Workload, return img, nil } -func imageInstallerImage(workload workload.Workload, +func imageInstallerImage(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, @@ -612,7 +611,7 @@ func imageInstallerImage(workload workload.Workload, img.Kickstart.Timezone = &img.OSCustomizations.Timezone img.Platform = t.platform - img.Workload = workload + img.ImgTypeCustomizations = imgTypeCustomizations img.ExtraBasePackages = packageSets[installerPkgsKey] @@ -655,7 +654,7 @@ func imageInstallerImage(workload workload.Workload, return img, nil } -func iotCommitImage(workload workload.Workload, +func iotCommitImage(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, @@ -683,7 +682,7 @@ func iotCommitImage(workload workload.Workload, } img.Environment = &t.ImageTypeYAML.Environment - img.Workload = workload + img.ImgTypeCustomizations = imgTypeCustomizations img.OSTreeParent = parentCommit img.OSVersion = d.OsVersion() img.Filename = t.Filename() @@ -691,7 +690,7 @@ func iotCommitImage(workload workload.Workload, return img, nil } -func bootableContainerImage(workload workload.Workload, +func bootableContainerImage(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, @@ -713,7 +712,7 @@ func bootableContainerImage(workload workload.Workload, } img.Environment = &t.ImageTypeYAML.Environment - img.Workload = workload + img.ImgTypeCustomizations = imgTypeCustomizations img.OSTreeParent = parentCommit img.OSVersion = d.OsVersion() img.Filename = t.Filename() @@ -731,7 +730,7 @@ func bootableContainerImage(workload workload.Workload, return img, nil } -func iotContainerImage(workload workload.Workload, +func iotContainerImage(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, @@ -758,7 +757,7 @@ func iotContainerImage(workload workload.Workload, img.ContainerLanguage = img.OSCustomizations.Language img.Environment = &t.ImageTypeYAML.Environment - img.Workload = workload + img.ImgTypeCustomizations = imgTypeCustomizations img.OSTreeParent = parentCommit img.OSVersion = d.OsVersion() img.ExtraContainerPackages = packageSets[containerPkgsKey] @@ -767,7 +766,7 @@ func iotContainerImage(workload workload.Workload, return img, nil } -func iotInstallerImage(workload workload.Workload, +func iotInstallerImage(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, @@ -837,7 +836,7 @@ func iotInstallerImage(workload workload.Workload, return img, nil } -func iotImage(workload workload.Workload, +func iotImage(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, @@ -859,7 +858,7 @@ func iotImage(workload workload.Workload, img.OSTreeDeploymentCustomizations = deploymentConfig img.Platform = t.platform - img.Workload = workload + img.ImgTypeCustomizations = imgTypeCustomizations img.Remote = ostree.Remote{ Name: t.ImageTypeYAML.OSTree.RemoteName, @@ -885,7 +884,7 @@ func iotImage(workload workload.Workload, return img, nil } -func iotSimplifiedInstallerImage(workload workload.Workload, +func iotSimplifiedInstallerImage(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, @@ -907,7 +906,7 @@ func iotSimplifiedInstallerImage(workload workload.Workload, rawImg.OSTreeDeploymentCustomizations = deploymentConfig rawImg.Platform = t.platform - rawImg.Workload = workload + rawImg.ImgTypeCustomizations = imgTypeCustomizations rawImg.Remote = ostree.Remote{ Name: t.OSTree.RemoteName, } @@ -928,7 +927,7 @@ func iotSimplifiedInstallerImage(workload workload.Workload, img := image.NewOSTreeSimplifiedInstaller(rawImg, customizations.InstallationDevice) img.ExtraBasePackages = packageSets[installerPkgsKey] - // img.Workload = workload + // img.ImgTypeCustomizations = imgTypeCustomizations img.Platform = t.platform img.Filename = t.Filename() if bpFDO := customizations.GetFDO(); bpFDO != nil { @@ -970,7 +969,7 @@ func iotSimplifiedInstallerImage(workload workload.Workload, } // Make an Anaconda installer boot.iso -func netinstImage(workload workload.Workload, +func netinstImage(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, @@ -987,7 +986,7 @@ func netinstImage(workload workload.Workload, } img.Platform = t.platform - img.Workload = workload + img.ImgTypeCustomizations = imgTypeCustomizations img.ExtraBasePackages = packageSets[installerPkgsKey] var err error diff --git a/pkg/distro/generic/imagetype.go b/pkg/distro/generic/imagetype.go index aa19cd7059..7369618390 100644 --- a/pkg/distro/generic/imagetype.go +++ b/pkg/distro/generic/imagetype.go @@ -8,7 +8,6 @@ import ( "github.com/osbuild/blueprint/pkg/blueprint" "github.com/osbuild/images/internal/common" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/container" "github.com/osbuild/images/pkg/datasizes" "github.com/osbuild/images/pkg/disk" @@ -21,7 +20,7 @@ import ( "github.com/osbuild/images/pkg/rpmmd" ) -type imageFunc func(workload workload.Workload, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, packageSets map[string]rpmmd.PackageSet, containers []container.SourceSpec, rng *rand.Rand) (image.ImageKind, error) +type imageFunc func(imgTypeCustomizations manifest.OSCustomizations, t *imageType, bp *blueprint.Blueprint, options distro.ImageOptions, packageSets map[string]rpmmd.PackageSet, containers []container.SourceSpec, rng *rand.Rand) (image.ImageKind, error) type isoLabelFunc func(t *imageType) string @@ -258,15 +257,13 @@ func (t *imageType) Manifest(bp *blueprint.Blueprint, installFromRepos := blueprint.RepoCustomizationsInstallFromOnly(customRepos) payloadRepos = append(payloadRepos, installFromRepos...) - cw := &workload.Custom{ - BaseWorkload: workload.BaseWorkload{ - Repos: payloadRepos, - }, - Packages: bp.GetPackagesEx(false), - EnabledModules: bp.GetEnabledModules(), + cw := manifest.OSCustomizations{ + ExtraBaseRepos: payloadRepos, + BasePackages: bp.GetPackagesEx(false), + BaseModules: bp.GetEnabledModules(), } if services := bp.Customizations.GetServices(); services != nil { - cw.Services = services.Enabled + cw.EnabledServices = services.Enabled cw.DisabledServices = services.Disabled cw.MaskedServices = services.Masked } diff --git a/pkg/image/anaconda_live_installer.go b/pkg/image/anaconda_live_installer.go index 4e271d0d33..34a2959ed0 100644 --- a/pkg/image/anaconda_live_installer.go +++ b/pkg/image/anaconda_live_installer.go @@ -5,7 +5,6 @@ import ( "math/rand" "github.com/osbuild/images/internal/environment" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/arch" "github.com/osbuild/images/pkg/artifact" "github.com/osbuild/images/pkg/datasizes" @@ -20,7 +19,7 @@ type AnacondaLiveInstaller struct { Platform platform.Platform InstallerCustomizations manifest.InstallerCustomizations Environment environment.Environment - Workload workload.Workload + ImgTypeCustomizations manifest.OSCustomizations ExtraBasePackages rpmmd.PackageSet diff --git a/pkg/image/anaconda_net_installer.go b/pkg/image/anaconda_net_installer.go index a52dbde554..9aa4dcae39 100644 --- a/pkg/image/anaconda_net_installer.go +++ b/pkg/image/anaconda_net_installer.go @@ -5,7 +5,6 @@ import ( "math/rand" "github.com/osbuild/images/internal/environment" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/arch" "github.com/osbuild/images/pkg/artifact" "github.com/osbuild/images/pkg/customizations/anaconda" @@ -21,7 +20,7 @@ type AnacondaNetInstaller struct { Platform platform.Platform InstallerCustomizations manifest.InstallerCustomizations Environment environment.Environment - Workload workload.Workload + ImgTypeCustomizations manifest.OSCustomizations ExtraBasePackages rpmmd.PackageSet diff --git a/pkg/image/anaconda_tar_installer.go b/pkg/image/anaconda_tar_installer.go index ddc0334278..de293b5958 100644 --- a/pkg/image/anaconda_tar_installer.go +++ b/pkg/image/anaconda_tar_installer.go @@ -6,7 +6,6 @@ import ( "path/filepath" "github.com/osbuild/images/internal/environment" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/arch" "github.com/osbuild/images/pkg/artifact" "github.com/osbuild/images/pkg/customizations/anaconda" @@ -44,7 +43,7 @@ type AnacondaTarInstaller struct { OSCustomizations manifest.OSCustomizations InstallerCustomizations manifest.InstallerCustomizations Environment environment.Environment - Workload workload.Workload + ImgTypeCustomizations manifest.OSCustomizations ExtraBasePackages rpmmd.PackageSet @@ -164,7 +163,7 @@ func (img *AnacondaTarInstaller) InstantiateManifest(m *manifest.Manifest, osPipeline := manifest.NewOS(buildPipeline, img.Platform, repos) osPipeline.OSCustomizations = img.OSCustomizations osPipeline.Environment = img.Environment - osPipeline.Workload = img.Workload + osPipeline.ImgTypeCustomizations = img.ImgTypeCustomizations isoTreePipeline := manifest.NewAnacondaInstallerISOTree(buildPipeline, anacondaPipeline, rootfsImagePipeline, bootTreePipeline) // TODO: the partition table is required - make it a ctor arg or set a default one in the pipeline diff --git a/pkg/image/archive.go b/pkg/image/archive.go index ea605996ac..835e030675 100644 --- a/pkg/image/archive.go +++ b/pkg/image/archive.go @@ -4,7 +4,6 @@ import ( "math/rand" "github.com/osbuild/images/internal/environment" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/artifact" "github.com/osbuild/images/pkg/manifest" "github.com/osbuild/images/pkg/platform" @@ -14,12 +13,12 @@ import ( type Archive struct { Base - Platform platform.Platform - OSCustomizations manifest.OSCustomizations - Environment environment.Environment - Workload workload.Workload - Filename string - Compression string + Platform platform.Platform + OSCustomizations manifest.OSCustomizations + Environment environment.Environment + ImgTypeCustomizations manifest.OSCustomizations + Filename string + Compression string OSVersion string } @@ -40,7 +39,7 @@ func (img *Archive) InstantiateManifest(m *manifest.Manifest, osPipeline := manifest.NewOS(buildPipeline, img.Platform, repos) osPipeline.OSCustomizations = img.OSCustomizations osPipeline.Environment = img.Environment - osPipeline.Workload = img.Workload + osPipeline.ImgTypeCustomizations = img.ImgTypeCustomizations osPipeline.OSVersion = img.OSVersion tarPipeline := manifest.NewTar(buildPipeline, osPipeline, "archive") diff --git a/pkg/image/container.go b/pkg/image/container.go index 5b70a6eb59..4a396f84b6 100644 --- a/pkg/image/container.go +++ b/pkg/image/container.go @@ -4,7 +4,6 @@ import ( "math/rand" "github.com/osbuild/images/internal/environment" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/artifact" "github.com/osbuild/images/pkg/manifest" "github.com/osbuild/images/pkg/platform" @@ -14,11 +13,11 @@ import ( type BaseContainer struct { Base - Platform platform.Platform - OSCustomizations manifest.OSCustomizations - Environment environment.Environment - Workload workload.Workload - Filename string + Platform platform.Platform + OSCustomizations manifest.OSCustomizations + Environment environment.Environment + ImgTypeCustomizations manifest.OSCustomizations + Filename string } func NewBaseContainer() *BaseContainer { @@ -37,7 +36,7 @@ func (img *BaseContainer) InstantiateManifest(m *manifest.Manifest, osPipeline := manifest.NewOS(buildPipeline, img.Platform, repos) osPipeline.OSCustomizations = img.OSCustomizations osPipeline.Environment = img.Environment - osPipeline.Workload = img.Workload + osPipeline.ImgTypeCustomizations = img.ImgTypeCustomizations ociPipeline := manifest.NewOCIContainer(buildPipeline, osPipeline) ociPipeline.SetFilename(img.Filename) diff --git a/pkg/image/disk.go b/pkg/image/disk.go index 05b72499ed..a48f56b5df 100644 --- a/pkg/image/disk.go +++ b/pkg/image/disk.go @@ -7,7 +7,6 @@ import ( "strings" "github.com/osbuild/images/internal/environment" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/artifact" "github.com/osbuild/images/pkg/disk" "github.com/osbuild/images/pkg/manifest" @@ -19,13 +18,13 @@ import ( type DiskImage struct { Base - Platform platform.Platform - PartitionTable *disk.PartitionTable - OSCustomizations manifest.OSCustomizations - Environment environment.Environment - Workload workload.Workload - Filename string - Compression string + Platform platform.Platform + PartitionTable *disk.PartitionTable + OSCustomizations manifest.OSCustomizations + Environment environment.Environment + ImgTypeCustomizations manifest.OSCustomizations + Filename string + Compression string // Control the VPC subformat use of force_size VPCForceSize *bool @@ -56,7 +55,7 @@ func (img *DiskImage) InstantiateManifest(m *manifest.Manifest, osPipeline.PartitionTable = img.PartitionTable osPipeline.OSCustomizations = img.OSCustomizations osPipeline.Environment = img.Environment - osPipeline.Workload = img.Workload + osPipeline.ImgTypeCustomizations = img.ImgTypeCustomizations osPipeline.OSProduct = img.OSProduct osPipeline.OSVersion = img.OSVersion osPipeline.OSNick = img.OSNick diff --git a/pkg/image/ostree_archive.go b/pkg/image/ostree_archive.go index 54a018dd0f..5bc0ab092f 100644 --- a/pkg/image/ostree_archive.go +++ b/pkg/image/ostree_archive.go @@ -4,7 +4,6 @@ import ( "math/rand" "github.com/osbuild/images/internal/environment" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/artifact" "github.com/osbuild/images/pkg/customizations/bootc" "github.com/osbuild/images/pkg/manifest" @@ -16,10 +15,10 @@ import ( type OSTreeArchive struct { Base - Platform platform.Platform - OSCustomizations manifest.OSCustomizations - Environment environment.Environment - Workload workload.Workload + Platform platform.Platform + OSCustomizations manifest.OSCustomizations + Environment environment.Environment + ImgTypeCustomizations manifest.OSCustomizations // OSTreeParent specifies the source for an optional parent commit for the // new commit being built. @@ -59,7 +58,7 @@ func (img *OSTreeArchive) InstantiateManifest(m *manifest.Manifest, osPipeline := manifest.NewOS(buildPipeline, img.Platform, repos) osPipeline.OSCustomizations = img.OSCustomizations osPipeline.Environment = img.Environment - osPipeline.Workload = img.Workload + osPipeline.ImgTypeCustomizations = img.ImgTypeCustomizations osPipeline.OSTreeParent = img.OSTreeParent osPipeline.OSTreeRef = img.OSTreeRef osPipeline.OSCustomizations.InstallWeakDeps = img.InstallWeakDeps diff --git a/pkg/image/ostree_container.go b/pkg/image/ostree_container.go index d3914e858f..0c684a222d 100644 --- a/pkg/image/ostree_container.go +++ b/pkg/image/ostree_container.go @@ -4,7 +4,6 @@ import ( "math/rand" "github.com/osbuild/images/internal/environment" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/artifact" "github.com/osbuild/images/pkg/manifest" "github.com/osbuild/images/pkg/ostree" @@ -15,10 +14,10 @@ import ( type OSTreeContainer struct { Base - Platform platform.Platform - OSCustomizations manifest.OSCustomizations - Environment environment.Environment - Workload workload.Workload + Platform platform.Platform + OSCustomizations manifest.OSCustomizations + Environment environment.Environment + ImgTypeCustomizations manifest.OSCustomizations // OSTreeParent specifies the source for an optional parent commit for the // new commit being built. @@ -50,7 +49,7 @@ func (img *OSTreeContainer) InstantiateManifest(m *manifest.Manifest, osPipeline := manifest.NewOS(buildPipeline, img.Platform, repos) osPipeline.OSCustomizations = img.OSCustomizations osPipeline.Environment = img.Environment - osPipeline.Workload = img.Workload + osPipeline.ImgTypeCustomizations = img.ImgTypeCustomizations osPipeline.OSTreeRef = img.OSTreeRef osPipeline.OSTreeParent = img.OSTreeParent diff --git a/pkg/image/ostree_disk.go b/pkg/image/ostree_disk.go index e324b505f3..e0318362d7 100644 --- a/pkg/image/ostree_disk.go +++ b/pkg/image/ostree_disk.go @@ -4,7 +4,6 @@ import ( "fmt" "math/rand" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/artifact" "github.com/osbuild/images/pkg/container" "github.com/osbuild/images/pkg/disk" @@ -18,9 +17,9 @@ import ( type OSTreeDiskImage struct { Base - Platform platform.Platform - Workload workload.Workload - PartitionTable *disk.PartitionTable + Platform platform.Platform + ImgTypeCustomizations manifest.OSCustomizations + PartitionTable *disk.PartitionTable OSTreeDeploymentCustomizations manifest.OSTreeDeploymentCustomizations @@ -80,10 +79,9 @@ func baseRawOstreeImage(img *OSTreeDiskImage, buildPipeline manifest.Build, opts osPipeline.UseBootupd = opts.useBootupd // other image types (e.g. live) pass the workload to the pipeline. - if img.Workload != nil { - osPipeline.EnabledServices = img.Workload.GetServices() - osPipeline.DisabledServices = img.Workload.GetDisabledServices() - } + osPipeline.EnabledServices = img.ImgTypeCustomizations.EnabledServices + osPipeline.DisabledServices = img.ImgTypeCustomizations.DisabledServices + return manifest.NewRawOStreeImage(buildPipeline, osPipeline, img.Platform) } diff --git a/pkg/image/ostree_disk_test.go b/pkg/image/ostree_disk_test.go index 28a46d64a6..188e308dba 100644 --- a/pkg/image/ostree_disk_test.go +++ b/pkg/image/ostree_disk_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/require" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/arch" "github.com/osbuild/images/pkg/container" "github.com/osbuild/images/pkg/image" @@ -48,7 +47,6 @@ func TestOSTreeDiskImageManifestSetsContainerBuildable(t *testing.T) { BIOSPlatform: "i386-pc", UEFIVendor: "fedora", } - img.Workload = &workload.BaseWorkload{} img.OSName = "osname" img.ContainerBuildable = containerBuildable diff --git a/pkg/image/ostree_simplified_installer.go b/pkg/image/ostree_simplified_installer.go index 9475ff438d..05e5a43d04 100644 --- a/pkg/image/ostree_simplified_installer.go +++ b/pkg/image/ostree_simplified_installer.go @@ -5,7 +5,6 @@ import ( "math/rand" "github.com/osbuild/images/internal/environment" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/arch" "github.com/osbuild/images/pkg/artifact" "github.com/osbuild/images/pkg/customizations/fdo" @@ -22,10 +21,10 @@ type OSTreeSimplifiedInstaller struct { // Raw image that will be created and embedded rawImage *OSTreeDiskImage - Platform platform.Platform - OSCustomizations manifest.OSCustomizations - Environment environment.Environment - Workload workload.Workload + Platform platform.Platform + OSCustomizations manifest.OSCustomizations + Environment environment.Environment + ImgTypeCustomizations manifest.OSCustomizations ExtraBasePackages rpmmd.PackageSet diff --git a/pkg/manifest/os.go b/pkg/manifest/os.go index dacfdbea12..dc3365f765 100644 --- a/pkg/manifest/os.go +++ b/pkg/manifest/os.go @@ -10,7 +10,6 @@ import ( "github.com/osbuild/images/internal/common" "github.com/osbuild/images/internal/environment" - "github.com/osbuild/images/internal/workload" "github.com/osbuild/images/pkg/arch" "github.com/osbuild/images/pkg/container" "github.com/osbuild/images/pkg/customizations/bootc" @@ -40,6 +39,10 @@ type OSCustomizations struct { // These are the statically defined packages for the image type. BasePackages []string + // Modules to install in addition to the ones required by the pipeline. + // These are the statically defined packages for the image type. + BaseModules []string + // Packages to exclude from the base package set. This is useful in // case of weak dependencies, comps groups, or where multiple packages // can satisfy a dependency. Must not conflict with the included base @@ -193,8 +196,10 @@ type OS struct { // Environment the system will run in Environment environment.Environment - // Workload to install on top of the base system - Workload workload.Workload + + // ImageTypeCustomizations come from the image type + ImgTypeCustomizations OSCustomizations + // Ref of ostree commit (optional). If empty the tree cannot be in an ostree commit OSTreeRef string // OSTreeParent source spec (optional). If nil the new commit (if @@ -335,23 +340,21 @@ func (p *OS) getPackageSetChain(Distro) []rpmmd.PackageSet { }, } - if p.Workload != nil { - workloadPackages := p.Workload.GetPackages() - if len(workloadPackages) > 0 { - ps := rpmmd.PackageSet{ - Include: workloadPackages, - Repositories: append(osRepos, p.Workload.GetRepos()...), - // Although 'false' is the default value, set it explicitly to make - // it visible that we are not adding weak dependencies. - InstallWeakDeps: false, - } + imgTypePackages := p.ImgTypeCustomizations.BasePackages + if len(imgTypePackages) > 0 { + ps := rpmmd.PackageSet{ + Include: imgTypePackages, + Repositories: append(osRepos, p.ImgTypeCustomizations.ExtraBaseRepos...), + // Although 'false' is the default value, set it explicitly to make + // it visible that we are not adding weak dependencies. + InstallWeakDeps: false, + } - workloadModules := p.Workload.GetEnabledModules() - if len(workloadModules) > 0 { - ps.EnabledModules = workloadModules - } - chain = append(chain, ps) + imgTypeModules := p.ImgTypeCustomizations.BaseModules + if len(imgTypeModules) > 0 { + ps.EnabledModules = imgTypeModules } + chain = append(chain, ps) } return chain @@ -503,9 +506,8 @@ func (p *OS) serialize() osbuild.Pipeline { // collect all repos for this pipeline to create the repository options allRepos := append(p.repos, p.OSCustomizations.ExtraBaseRepos...) - if p.Workload != nil { - allRepos = append(allRepos, p.Workload.GetRepos()...) - } + allRepos = append(allRepos, p.ImgTypeCustomizations.ExtraBaseRepos...) + rpmOptions := osbuild.NewRPMStageOptions(allRepos) if p.OSCustomizations.ExcludeDocs { if rpmOptions.Exclude == nil { @@ -858,11 +860,10 @@ func (p *OS) serialize() osbuild.Pipeline { if p.Environment != nil { enabledServices = append(enabledServices, p.Environment.GetServices()...) } - if p.Workload != nil { - enabledServices = append(enabledServices, p.Workload.GetServices()...) - disabledServices = append(disabledServices, p.Workload.GetDisabledServices()...) - maskedServices = append(maskedServices, p.Workload.GetMaskedServices()...) - } + enabledServices = append(enabledServices, p.ImgTypeCustomizations.EnabledServices...) + disabledServices = append(disabledServices, p.ImgTypeCustomizations.DisabledServices...) + maskedServices = append(maskedServices, p.ImgTypeCustomizations.MaskedServices...) + if len(enabledServices) != 0 || len(disabledServices) != 0 || len(maskedServices) != 0 || p.OSCustomizations.DefaultTarget != "" {