Skip to content

Commit 9d61d40

Browse files
committed
platform/metal: don't require metal artifacts for offline scenarios
There's no need for the metal images if we're testing e.g. `iso-offline-install.bios`. Previously, this didn't matter because we always had to build the metal and metal4k artifacts to build the live ISO. But nowadays with `cosa osbuild`, it's possible to have the live ISO built without the metal artifacts (well, it's still built, but not exported out of the osbuild environment). Probably should resolve that, but dropping that hard requirement on the kola side doesn't hurt either.
1 parent 57528fc commit 9d61d40

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

mantle/platform/metal.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,12 @@ type installerConfig struct {
601601

602602
func (inst *Install) InstallViaISOEmbed(kargs []string, liveIgnition, targetIgnition conf.Conf, outdir string, offline, minimal bool) (*InstalledMachine, error) {
603603
artifacts := []string{"live-iso"}
604-
if inst.Native4k {
605-
artifacts = append(artifacts, "metal4k")
606-
} else {
607-
artifacts = append(artifacts, "metal")
604+
if !offline {
605+
if inst.Native4k {
606+
artifacts = append(artifacts, "metal4k")
607+
} else {
608+
artifacts = append(artifacts, "metal")
609+
}
608610
}
609611
if err := inst.checkArtifactsExist(artifacts); err != nil {
610612
return nil, err
@@ -676,17 +678,6 @@ func (inst *Install) InstallViaISOEmbed(kargs []string, liveIgnition, targetIgni
676678
}
677679
srcisopath = newIso
678680

679-
var metalimg string
680-
if inst.Native4k {
681-
metalimg = inst.CosaBuild.Meta.BuildArtifacts.Metal4KNative.Path
682-
} else {
683-
metalimg = inst.CosaBuild.Meta.BuildArtifacts.Metal.Path
684-
}
685-
metalname, err := setupMetalImage(builddir, metalimg, tempdir)
686-
if err != nil {
687-
return nil, errors.Wrapf(err, "setting up metal image")
688-
}
689-
690681
var serializedTargetConfig string
691682
if offline {
692683
// note we leave ImageURL empty here; offline installs should now be the
@@ -696,6 +687,17 @@ func (inst *Install) InstallViaISOEmbed(kargs []string, liveIgnition, targetIgni
696687
// final installed host booting offline
697688
serializedTargetConfig = inst.ignition.String()
698689
} else {
690+
var metalimg string
691+
if inst.Native4k {
692+
metalimg = inst.CosaBuild.Meta.BuildArtifacts.Metal4KNative.Path
693+
} else {
694+
metalimg = inst.CosaBuild.Meta.BuildArtifacts.Metal.Path
695+
}
696+
metalname, err := setupMetalImage(builddir, metalimg, tempdir)
697+
if err != nil {
698+
return nil, errors.Wrapf(err, "setting up metal image")
699+
}
700+
699701
mux := http.NewServeMux()
700702
mux.Handle("/", http.FileServer(http.Dir(tempdir)))
701703
listener, err := net.Listen("tcp", ":0")

0 commit comments

Comments
 (0)