mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-04 10:24:37 +00:00
utils: Fix case version check for stable releases
For stable versions the format used `x.y.z`. kata-env was failing trying to make a new release from 1.11.0-rc to 1.11.0 This fix kata-env for releases 1.11+ where this regression was introduced. Fixes: kata-containers/runtime#2674 Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com> Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
committed by
Peng Tao
parent
48b20e75f8
commit
202a877d36
@@ -959,6 +959,13 @@ func TestCheckVersionConsistencyInComponents(t *testing.T) {
|
|||||||
"",
|
"",
|
||||||
"0.2.0-rc0",
|
"0.2.0-rc0",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
"kata-shim version 0.2.0-xxxxxxxxxxxxx",
|
||||||
|
"",
|
||||||
|
"0.2.0",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
origVersion := version
|
origVersion := version
|
||||||
|
@@ -161,7 +161,13 @@ func constructVersionInfo(version string) VersionInfo {
|
|||||||
return unknownVersionInfo
|
return unknownVersionInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
pres := strings.Split(sv.Pre[0].VersionStr, "-")
|
var pres string
|
||||||
|
if len(sv.Pre) > 0 {
|
||||||
|
presSplit := strings.Split(sv.Pre[0].VersionStr, "-")
|
||||||
|
if len(presSplit) > 2 {
|
||||||
|
pres = presSplit[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// version contains Commit info.
|
// version contains Commit info.
|
||||||
if len(pres) > 1 {
|
if len(pres) > 1 {
|
||||||
@@ -170,7 +176,7 @@ func constructVersionInfo(version string) VersionInfo {
|
|||||||
Major: sv.Major,
|
Major: sv.Major,
|
||||||
Minor: sv.Minor,
|
Minor: sv.Minor,
|
||||||
Patch: sv.Patch,
|
Patch: sv.Patch,
|
||||||
Commit: pres[1],
|
Commit: pres,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user