Skip to content

Commit

Permalink
kola/harness: detect LTS major version
Browse files Browse the repository at this point in the history
The LTS branch is flatcar-lts-MAJOR and only flatcar-MAJOR branch names
were considered which let to an invalid major version "lts" being
parsed.
Take the element after either "flatcar" or "flatcar-lts" when splitting
on "-". The full build ID is "dev-flatcar(-lts)-MAJOR-nightly-XYZ".
  • Loading branch information
pothos committed Aug 6, 2021
1 parent e4a6261 commit 102125e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,18 +436,22 @@ func getClusterSemver(flight platform.Flight, outputDir string) (*semver.Version
}
ver := strings.Split(string(out), "=")[1]

out, stderr, err = m.SSH("grep ^BUILD_ID= /etc/os-release | { grep -o 'dev-.*' || true ; } | cut -d - -f 2- | rev | cut -d - -f 2- | rev")
out, stderr, err = m.SSH("grep ^BUILD_ID= /etc/os-release")
if err != nil {
return nil, fmt.Errorf("parsing /etc/os-release for nightly branch in BUILD_ID: %v: %s", err, stderr)
return nil, fmt.Errorf("parsing /etc/os-release for BUILD_ID: %v: %s", err, stderr)
}
branch := string(out)
if branch == "main" || branch == "flatcar-master" {
build_id := string(out)
if strings.HasPrefix(build_id, "dev-main-nightly-") || strings.HasPrefix(build_id, "dev-flatcar-master-") {
// "main" is a nightly build of the main branch,
// "flatcar-master" refers to the manifest branch where dev builds are started
ver = "999999.99.99"
} else if strings.HasPrefix(branch, "flatcar-") {
} else if strings.HasPrefix(build_id, "dev-flatcar-") {
// flatcar-MAJOR is a nightly build of the release branch
major := strings.Split(branch, "-")[1]
parts := strings.Split(branch, "-")
major := parts[2]
if major == "lts" {
major = parts[3]
}
ver = major + ".99.99"
}
plog.Noticef("Using %q as version to filter tests...", ver)
Expand Down

0 comments on commit 102125e

Please sign in to comment.