Skip to content

Commit

Permalink
anaconda: add Preview
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
supakeen authored and achilleas-k committed Mar 18, 2024
1 parent e1b31c1 commit 83b9d68
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pkg/distro/fedora/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
2 changes: 2 additions & 0 deletions pkg/image/anaconda_container_installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type AnacondaContainerInstaller struct {
Ref string
OSVersion string
Release string
Preview bool

ContainerSource container.SourceSpec

Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pkg/image/anaconda_live_installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type AnacondaLiveInstaller struct {
OSName string
OSVersion string
Release string
Preview bool

Filename string

Expand Down Expand Up @@ -57,6 +58,7 @@ func (img *AnacondaLiveInstaller) InstantiateManifest(m *manifest.Manifest,
"kernel",
img.Product,
img.OSVersion,
img.Preview,
)

livePipeline.ExtraPackages = img.ExtraBasePackages.Include
Expand Down
2 changes: 2 additions & 0 deletions pkg/image/anaconda_ostree_installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type AnacondaOSTreeInstaller struct {
OSName string
OSVersion string
Release string
Preview bool
Remote string

Commit ostree.SourceSpec
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pkg/image/anaconda_tar_installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type AnacondaTarInstaller struct {
OSName string
OSVersion string
Release string
Preview bool

Filename string

Expand Down Expand Up @@ -110,6 +111,7 @@ func (img *AnacondaTarInstaller) InstantiateManifest(m *manifest.Manifest,
"kernel",
img.Product,
img.OSVersion,
img.Preview,
)

anacondaPipeline.ExtraPackages = img.ExtraBasePackages.Include
Expand Down
7 changes: 5 additions & 2 deletions pkg/manifest/anaconda_installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
Expand All @@ -94,6 +96,7 @@ func NewAnacondaInstaller(installerType AnacondaInstallerType,
kernelName: kernelName,
product: product,
version: version,
preview: preview,
}
buildPipeline.addDependent(p)
return p
Expand Down Expand Up @@ -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"}))

Expand Down
3 changes: 3 additions & 0 deletions pkg/manifest/anaconda_installer_iso_tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ func newTestAnacondaISOTree() *AnacondaInstallerISOTree {
product := ""
osversion := ""

preview := false

anacondaPipeline := NewAnacondaInstaller(
AnacondaInstallerTypePayload,
build,
Expand All @@ -39,6 +41,7 @@ func newTestAnacondaISOTree() *AnacondaInstallerISOTree {
"kernel",
product,
osversion,
preview,
)
rootfsImagePipeline := NewISORootfsImg(build, anacondaPipeline)
bootTreePipeline := NewEFIBootTree(build, product, osversion)
Expand Down

0 comments on commit 83b9d68

Please sign in to comment.