From 83b9d68e70e0b3a066b4b0ff6f3d19b7047694a6 Mon Sep 17 00:00:00 2001 From: Simon de Vlieger Date: Sun, 17 Mar 2024 19:15:04 +0100 Subject: [PATCH] anaconda: add `Preview` The `Preview` property on Anaconda images and pipelines replaces the previously hardcoded `Final` property being passed to the Buildstamp stage. Note that this is, again, a duplication of efforts so let's find out how to pass the value of `Preview` on from the API. --- pkg/distro/fedora/images.go | 3 +++ pkg/image/anaconda_container_installer.go | 2 ++ pkg/image/anaconda_live_installer.go | 2 ++ pkg/image/anaconda_ostree_installer.go | 2 ++ pkg/image/anaconda_tar_installer.go | 2 ++ pkg/manifest/anaconda_installer.go | 7 +++++-- pkg/manifest/anaconda_installer_iso_tree_test.go | 3 +++ 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/pkg/distro/fedora/images.go b/pkg/distro/fedora/images.go index 13b1f4c0c7..c4819a91f5 100644 --- a/pkg/distro/fedora/images.go +++ b/pkg/distro/fedora/images.go @@ -334,6 +334,7 @@ func liveInstallerImage(workload workload.Workload, img.OSVersion = d.osVersion img.Release = fmt.Sprintf("%s %s", d.product, d.osVersion) img.ISOLabel = fmt.Sprintf(ISO_LABEL, img.Product, img.OSVersion, img.Variant, img.Platform.GetArch()) + img.Preview = common.VersionGreaterThanOrEqual(img.OSVersion, VERSION_BRANCHED) img.Filename = t.Filename() @@ -390,6 +391,7 @@ func imageInstallerImage(workload workload.Workload, // We don't know the variant of the OS pipeline being installed img.ISOLabel = fmt.Sprintf(ISO_LABEL, img.Product, img.OSVersion, img.Variant, img.Platform.GetArch()) + img.Preview = common.VersionGreaterThanOrEqual(img.OSVersion, VERSION_BRANCHED) img.Filename = t.Filename() @@ -554,6 +556,7 @@ func iotInstallerImage(workload workload.Workload, img.OSVersion = d.osVersion img.Release = fmt.Sprintf("%s %s", d.product, d.osVersion) img.ISOLabel = fmt.Sprintf(ISO_LABEL, img.Product, img.OSVersion, img.Variant, img.Platform.GetArch()) + img.Preview = common.VersionGreaterThanOrEqual(img.OSVersion, VERSION_BRANCHED) img.Filename = t.Filename() diff --git a/pkg/image/anaconda_container_installer.go b/pkg/image/anaconda_container_installer.go index bdb8ddf218..ec821272e5 100644 --- a/pkg/image/anaconda_container_installer.go +++ b/pkg/image/anaconda_container_installer.go @@ -33,6 +33,7 @@ type AnacondaContainerInstaller struct { Ref string OSVersion string Release string + Preview bool ContainerSource container.SourceSpec @@ -67,6 +68,7 @@ func (img *AnacondaContainerInstaller) InstantiateManifest(m *manifest.Manifest, "kernel", img.Product, img.OSVersion, + img.Preview, ) // This is only built with ELN for now diff --git a/pkg/image/anaconda_live_installer.go b/pkg/image/anaconda_live_installer.go index 7b1180e0aa..e602edb718 100644 --- a/pkg/image/anaconda_live_installer.go +++ b/pkg/image/anaconda_live_installer.go @@ -30,6 +30,7 @@ type AnacondaLiveInstaller struct { OSName string OSVersion string Release string + Preview bool Filename string @@ -57,6 +58,7 @@ func (img *AnacondaLiveInstaller) InstantiateManifest(m *manifest.Manifest, "kernel", img.Product, img.OSVersion, + img.Preview, ) livePipeline.ExtraPackages = img.ExtraBasePackages.Include diff --git a/pkg/image/anaconda_ostree_installer.go b/pkg/image/anaconda_ostree_installer.go index 7786844b3d..646120e068 100644 --- a/pkg/image/anaconda_ostree_installer.go +++ b/pkg/image/anaconda_ostree_installer.go @@ -43,6 +43,7 @@ type AnacondaOSTreeInstaller struct { OSName string OSVersion string Release string + Preview bool Remote string Commit ostree.SourceSpec @@ -77,6 +78,7 @@ func (img *AnacondaOSTreeInstaller) InstantiateManifest(m *manifest.Manifest, "kernel", img.Product, img.OSVersion, + img.Preview, ) anacondaPipeline.ExtraPackages = img.ExtraBasePackages.Include anacondaPipeline.ExcludePackages = img.ExtraBasePackages.Exclude diff --git a/pkg/image/anaconda_tar_installer.go b/pkg/image/anaconda_tar_installer.go index c1f7905d21..e653bd51e9 100644 --- a/pkg/image/anaconda_tar_installer.go +++ b/pkg/image/anaconda_tar_installer.go @@ -74,6 +74,7 @@ type AnacondaTarInstaller struct { OSName string OSVersion string Release string + Preview bool Filename string @@ -110,6 +111,7 @@ func (img *AnacondaTarInstaller) InstantiateManifest(m *manifest.Manifest, "kernel", img.Product, img.OSVersion, + img.Preview, ) anacondaPipeline.ExtraPackages = img.ExtraBasePackages.Include diff --git a/pkg/manifest/anaconda_installer.go b/pkg/manifest/anaconda_installer.go index 4df436f2b1..8342316f1f 100644 --- a/pkg/manifest/anaconda_installer.go +++ b/pkg/manifest/anaconda_installer.go @@ -60,6 +60,7 @@ type AnacondaInstaller struct { kernelVer string product string version string + preview bool // Interactive defaults is a kickstart stage that can be provided, it // will be written to /usr/share/anaconda/interactive-defaults @@ -84,7 +85,8 @@ func NewAnacondaInstaller(installerType AnacondaInstallerType, repos []rpmmd.RepoConfig, kernelName, product, - version string) *AnacondaInstaller { + version string, + preview bool) *AnacondaInstaller { name := "anaconda-tree" p := &AnacondaInstaller{ Base: NewBase(name, buildPipeline), @@ -94,6 +96,7 @@ func NewAnacondaInstaller(installerType AnacondaInstallerType, kernelName: kernelName, product: product, version: version, + preview: preview, } buildPipeline.addDependent(p) return p @@ -208,7 +211,7 @@ func (p *AnacondaInstaller) serialize() osbuild.Pipeline { Product: p.product, Variant: p.Variant, Version: p.version, - Final: true, + Final: !p.preview, })) pipeline.AddStage(osbuild.NewLocaleStage(&osbuild.LocaleStageOptions{Language: "en_US.UTF-8"})) diff --git a/pkg/manifest/anaconda_installer_iso_tree_test.go b/pkg/manifest/anaconda_installer_iso_tree_test.go index 5ebddf5f0b..6bebc43489 100644 --- a/pkg/manifest/anaconda_installer_iso_tree_test.go +++ b/pkg/manifest/anaconda_installer_iso_tree_test.go @@ -31,6 +31,8 @@ func newTestAnacondaISOTree() *AnacondaInstallerISOTree { product := "" osversion := "" + preview := false + anacondaPipeline := NewAnacondaInstaller( AnacondaInstallerTypePayload, build, @@ -39,6 +41,7 @@ func newTestAnacondaISOTree() *AnacondaInstallerISOTree { "kernel", product, osversion, + preview, ) rootfsImagePipeline := NewISORootfsImg(build, anacondaPipeline) bootTreePipeline := NewEFIBootTree(build, product, osversion)