mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
release: Fix release candidate to major version upgrade check
Fix `kata-runtime kata-check`'s network version check which was failing when the user was running a release candidate build and the latest release was a major one, two examples of the error being: - `BUG: unhandled scenario: current version: 1.12.0-rc0, latest version: 1.12.0` - `BUG: unhandled scenario: current version: 2.0.0-rc0, latest version: 2.0.0` Fixes: #1104. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
2e0bf40adb
commit
8f38265be4
@ -321,6 +321,12 @@ func getNewReleaseType(current semver.Version, latest semver.Version) (string, e
|
||||
}
|
||||
} else if latest.Patch == current.Patch && len(latest.Pre) > 0 {
|
||||
desc = "pre-release"
|
||||
} else if latest.Major == current.Major &&
|
||||
latest.Minor == current.Minor &&
|
||||
latest.Patch == current.Patch {
|
||||
if len(current.Pre) > 0 && len(latest.Pre) == 0 {
|
||||
desc = "major"
|
||||
}
|
||||
} else {
|
||||
return "", fmt.Errorf("BUG: unhandled scenario: current version: %s, latest version: %s", current, latest)
|
||||
}
|
||||
|
@ -488,6 +488,12 @@ func TestGetNewReleaseType(t *testing.T) {
|
||||
{"1.0.0", "1.0.3", false, "patch"},
|
||||
{"1.0.0-beta29", "1.0.0-beta30", false, "pre-release"},
|
||||
{"1.0.0", "1.0.3-alpha99.1b", false, "patch pre-release"},
|
||||
|
||||
{"2.0.0-rc0", "2.0.0", false, "major"},
|
||||
{"2.0.0-rc1", "2.0.0", false, "major"},
|
||||
|
||||
{"1.12.0-rc0", "1.12.0", false, "major"},
|
||||
{"1.12.0-rc5", "1.12.0", false, "major"},
|
||||
}
|
||||
|
||||
for i, d := range data {
|
||||
|
Loading…
Reference in New Issue
Block a user