-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support version compatibility check for pre-release versions #2069
Conversation
Signed-off-by: Keran Yang <[email protected]>
Signed-off-by: Keran Yang <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2069 +/- ##
==========================================
+ Coverage 63.68% 63.96% +0.28%
==========================================
Files 320 321 +1
Lines 29345 29572 +227
==========================================
+ Hits 18687 18916 +229
+ Misses 9641 9637 -4
- Partials 1017 1019 +2 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Keran Yang <[email protected]>
Signed-off-by: Keran Yang <[email protected]>
Hey @KeranYang |
@kohlisid thank you. I will make similar changes to mono vertex using this PR. Please stay tuned for new commits. |
Signed-off-by: Keran Yang <[email protected]>
Signed-off-by: Keran Yang <[email protected]>
Signed-off-by: Keran Yang <[email protected]>
Signed-off-by: Keran Yang <[email protected]>
Signed-off-by: Keran Yang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do no use unwrap
, it is like panic
. use map_error
instead and convert to Result
, then short-circuit the return using ?
.
rust/monovertex/src/server_info.rs
Outdated
@@ -79,6 +79,39 @@ pub async fn check_for_server_compatibility( | |||
|
|||
/// Checks if the given version meets the specified constraint. | |||
fn check_constraint(version: &Version, constraint: &str) -> error::Result<()> { | |||
let binding = version.to_string(); | |||
// extract the major.minor.patch version | |||
let mmp_version = binding.split('-').next().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if there is no -
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it returns the original string itself.
Signed-off-by: Keran Yang <[email protected]>
Signed-off-by: Keran Yang <[email protected]>
@kohlisid monovertex change added, please review. Thanks! |
rust/monovertex/src/server_info.rs
Outdated
.map_err(|e| Error::ServerInfoError(format!("Error parsing Numaflow version: {}", e)))?; | ||
|
||
// Create a version constraint based on the minimum numaflow version | ||
let numaflow_constraint = format!(">={}", min_numaflow_version); | ||
check_constraint(&numaflow_version_semver, &numaflow_constraint).map_err(|e| { | ||
Error::ServerInfoError(format!( | ||
"numaflow version {} must be upgraded to at least {}, in order to work with current SDK version {}", | ||
numaflow_version_semver, min_numaflow_version, e | ||
numaflow_version_semver, human_readable(min_numaflow_version.to_string()), e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you calling to_string()
? just implement Debug for Version
via NewType
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vigith , thanks for introducing to me the Debug trait. After learning a bit of it, I would like to keep my change as it is. My use case is to convert the version string used by constraint to a human-readable string. I don't want users to see "please update numaflow to 1.3.1-z", which is confusing, I want them to see "1-3-1".
This is a very simple string conversion. Using Debug will require me to create a new type which wraps a string and create object of that struct during compatibility check, which is extra code. Please let me know if my understanding is off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't "human-readable string" all about Debug
Trait is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, I created a separate issue to track. #2076
rust/monovertex/src/server_info.rs
Outdated
// e.g., if the given version is "0.8.0rc100", human-readable version is "0.8.0". | ||
// if the given version is "0.8.0-z", "0.8.0". | ||
// if "0.8.0-rc1", "0.8.0-rc1". | ||
fn human_readable(ver: String) -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impl Debug
via the above asked NewType?
"0.8.0b1", "0.8.0b1" for python. | ||
2. The minimum supported version is a stable version. | ||
In this case, put (almost) the largest available pre-release version of the stable version in the map. | ||
E.g., if the minimum supported version is "0.8.0", then put "0.8.0-z" for java, go, rust, "0.8.0rc100" for python. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, why using -z
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's mainly because of the golang semver library "considering pre-releases to be invalid if the ranges does not include one". So we have to put a pre-release version in the constraint. To do so, we need to put the largest pre-release, hence -z
and rc100
for python.
I will improve the docs accordingly.
Signed-off-by: Keran Yang <[email protected]>
Signed-off-by: Keran Yang <[email protected]>
) Signed-off-by: Keran Yang <[email protected]>
…maproj#2069) Signed-off-by: Keran Yang <[email protected]>
TODO - once this PR gets approved, I will update the
minNumaflowVersion
in each SDK to add more guidelines on what version string to choose.closes #2064