func GetValidPatchVersion()

in pkg/agent/datamodel/versions.go [385:419]


func GetValidPatchVersion(orchType, orchVer string, isUpdate, hasWindows bool) string {
	if orchVer == "" {
		return RationalizeReleaseAndVersion(
			orchType,
			"",
			"",
			isUpdate,
			hasWindows)
	}

	/* check if the current version is valid, this allows us to have multiple supported patch
	versions in the future if we need it. */
	version := RationalizeReleaseAndVersion(
		orchType,
		"",
		orchVer,
		isUpdate,
		hasWindows)

	if version == "" {
		sv, err := semver.Make(orchVer)
		if err != nil {
			return ""
		}
		sr := fmt.Sprintf("%d.%d", sv.Major, sv.Minor)

		version = RationalizeReleaseAndVersion(
			orchType,
			sr,
			"",
			isUpdate,
			hasWindows)
	}
	return version
}