Skip to content

Commit

Permalink
kola: support nightly version in version comparions
Browse files Browse the repository at this point in the history
The nightly version is the build date but the build ID has the branch
reference. To support the version comparion for nightly builds we need
to generate a version for the "main" branch and the major version
branches that is higher than the current release version.

Use 9999.99.99 as version in the semantic version checks for nightly
builds from the "main" branch or custom dev builds and use MAJOR.99.99
as version for nightly builds from the release branch.
  • Loading branch information
pothos committed Aug 2, 2021
1 parent dbf4b8e commit f4d8cbd
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,25 @@ func getClusterSemver(flight platform.Flight, outputDir string) (*semver.Version

out, stderr, err := m.SSH("grep ^VERSION_ID= /etc/os-release")
if err != nil {
return nil, fmt.Errorf("parsing /etc/os-release: %v: %s", err, stderr)
return nil, fmt.Errorf("parsing /etc/os-release for VERSION_ID: %v: %s", err, stderr)
}
ver := strings.Split(string(out), "=")[1]

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

// TODO: add distro specific version handling
switch Options.Distribution {
case "cl":
Expand Down

0 comments on commit f4d8cbd

Please sign in to comment.