Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 18 additions & 46 deletions mantle/kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,54 +372,31 @@ type DenyListObj struct {
Arches []string `yaml:"arches"`
Platforms []string `yaml:"platforms"`
SnoozeDate string `yaml:"snooze"`
OsVersion []string `yaml:"osversion"`
Warn bool `yaml:"warn"`
}

type ManifestData struct {
Variables struct {
Stream string `yaml:"stream"`
OsVersion string `yaml:"osversion"`
} `yaml:"variables"`
type MetaDataLabels struct {
ImportedLabels map[string]string `json:"coreos-assembler.oci-imported-labels"`
}

type InitConfigData struct {
ConfigVariant string `json:"coreos-assembler.config-variant"`
}

func getStreamAndOsVersionFromManifest() (string, string, error) {
// Look for the right manifest, taking into account the variant
var manifest ManifestData
var pathToManifest string
pathToInitConfig := filepath.Join(Options.CosaWorkdir, "src/config.json")
initConfigFile, err := os.ReadFile(pathToInitConfig)
if os.IsNotExist(err) {
// No variant config found. Let's read the default manifest
pathToManifest = filepath.Join(Options.CosaWorkdir, "src/config/manifest.yaml")
} else if err != nil {
// Unexpected error
return "", "", err
} else {
// Figure out the variant and read the corresponding manifests
var initConfig InitConfigData
err = json.Unmarshal(initConfigFile, &initConfig)
if err != nil {
return "", "", err
}
pathToManifest = filepath.Join(Options.CosaWorkdir, fmt.Sprintf("src/config/manifest-%s.yaml", initConfig.ConfigVariant))
}
manifestFile, err := os.ReadFile(pathToManifest)
func getStreamFromMeta() (string, error) {
var metadata MetaDataLabels
pathToMetaJSON := filepath.Join(Options.CosaWorkdir, fmt.Sprintf("builds/latest/%s/meta.json", Options.CosaBuildArch))
Comment thread
dustymabe marked this conversation as resolved.
metaJSONFile, err := os.ReadFile(pathToMetaJSON)
if err != nil {
return "", "", err
return "", err
}
err = yaml.Unmarshal(manifestFile, &manifest)

err = json.Unmarshal(metaJSONFile, &metadata)
if err != nil {
return "", "", err
return "", err
}

stream := manifest.Variables.Stream
osversion := manifest.Variables.OsVersion
return stream, osversion, nil
var stream string
if metadata.ImportedLabels != nil {
stream = metadata.ImportedLabels["com.coreos.stream"]
}
return stream, nil
}

func ParseDenyListYaml(pltfrm string) error {
Expand All @@ -443,11 +420,10 @@ func ParseDenyListYaml(pltfrm string) error {
plog.Debug("Parsed kola-denylist.yaml")

var stream string
var osversion string

// Get the stream and osversion variables from the manifest since DenylistStream is not specified
// Get the stream variable from meta.json since DenylistStream is not specified
if len(DenylistStream) == 0 {
stream, osversion, err = getStreamAndOsVersionFromManifest()
stream, err = getStreamFromMeta()
if err != nil {
return err
}
Expand All @@ -459,7 +435,7 @@ func ParseDenyListYaml(pltfrm string) error {
arch := Options.CosaBuildArch
today := time.Now()

plog.Debugf("Denylist: Skipping tests for stream: '%s', osversion: '%s', arch: '%s'\n", stream, osversion, arch)
plog.Debugf("Denylist: Skipping tests for stream: '%s', arch: '%s'\n", stream, arch)

// Accumulate patterns filtering by set policies
plog.Debug("Processing denial patterns from yaml...")
Expand All @@ -476,10 +452,6 @@ func ParseDenyListYaml(pltfrm string) error {
continue
}

if len(osversion) > 0 && len(obj.OsVersion) > 0 && !HasString(osversion, obj.OsVersion) {
continue
}

// Process "special" patterns which aren't test names, but influence overall behavior
if obj.Pattern == SkipConsoleWarningsTag {
SkipConsoleWarnings = true
Expand Down