Skip to content

Commit e8e4ff9

Browse files
PeaceRebeldustymabe
authored andcommitted
kola: Use stream from oci image labels to figure out build ref
1 parent 1185b7a commit e8e4ff9

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

mantle/cmd/kola/kola.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -565,12 +565,22 @@ func syncFindParentImageOptions() error {
565565
skipSignature := false
566566
switch kola.Options.Distribution {
567567
case "fcos":
568-
// We're taking liberal shortcuts here... the cleaner way to do this is
569-
// parse commitmeta.json for `fedora-coreos.stream`
570-
if kola.CosaBuild.Meta.BuildRef == "" {
571-
return errors.New("no ref in build metadata")
568+
var stream string
569+
if kola.CosaBuild.Meta.CosaImportedOciImage {
570+
s, ok := kola.CosaBuild.Meta.OciLabels["fedora-coreos.stream"]
571+
if !ok {
572+
return errors.New("label 'fedora-coreos.stream' not found in build metadata")
573+
}
574+
stream = string(s)
575+
} else {
576+
// We still support this legacy hack for now, but eventually when we're
577+
// confident that latest kola doesn't need to handle builds built with the
578+
// legacy path, we can remove this code.
579+
if kola.CosaBuild.Meta.BuildRef == "" {
580+
return errors.New("no ref in build metadata")
581+
}
582+
stream = filepath.Base(kola.CosaBuild.Meta.BuildRef)
572583
}
573-
stream := filepath.Base(kola.CosaBuild.Meta.BuildRef)
574584
parentBaseURL, err = getParentFcosBuildBase(stream)
575585
if err != nil {
576586
return err

0 commit comments

Comments
 (0)