From 49eed41aa928eb709b8ed1c5e2366e49e487ee54 Mon Sep 17 00:00:00 2001 From: Abdullah Yildirim Date: Wed, 24 Apr 2024 16:27:54 -0400 Subject: [PATCH] chore: skip sdk compatibility check if server info does not contain sdk version (#1703) Signed-off-by: a3hadi --- pkg/sdkclient/serverinfo/serverinfo.go | 29 +++++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/pkg/sdkclient/serverinfo/serverinfo.go b/pkg/sdkclient/serverinfo/serverinfo.go index 834237bc3a..5f63112b28 100644 --- a/pkg/sdkclient/serverinfo/serverinfo.go +++ b/pkg/sdkclient/serverinfo/serverinfo.go @@ -26,8 +26,9 @@ import ( "github.com/Masterminds/semver/v3" pep440 "github.com/aquasecurity/go-pep440-version" - "github.com/numaproj/numaflow" "github.com/numaproj/numaflow-go/pkg/info" + + "github.com/numaproj/numaflow" ) // SDKServerInfo wait for the server to start and return the server info. @@ -63,20 +64,32 @@ func waitForServerInfo(timeout time.Duration, filePath string) (*info.ServerInfo } sdkVersion := serverInfo.Version + minNumaflowVersion := serverInfo.MinimumNumaflowVersion + sdkLanguage := serverInfo.Language numaflowVersion := numaflow.GetVersion().Version - // If we are testing locally or in CI, we can skip checking for numaflow compatibility issues - // because both return us a version string that the version check libraries can't properly parse. (local: "*latest*" CI: commit SHA) - if !strings.Contains(numaflowVersion, "latest") && !strings.Contains(numaflowVersion, numaflow.GetVersion().GitCommit) { - if err := checkNumaflowCompatibility(numaflowVersion, serverInfo.MinimumNumaflowVersion); err != nil { + // If MinimumNumaflowVersion is empty, skip the numaflow compatibility check as there was an + // error writing server info on the SDK side + if minNumaflowVersion == "" { + log.Printf("warning: failed to get the minimum numaflow version, skipping numaflow version compatibility check") + // If we are testing locally or in CI, we can skip checking for numaflow compatibility issues + // because both return us a version string that the version check libraries can't properly parse (local: "*latest*" CI: commit SHA) + } else if !strings.Contains(numaflowVersion, "latest") && !strings.Contains(numaflowVersion, numaflow.GetVersion().GitCommit) { + if err := checkNumaflowCompatibility(numaflowVersion, minNumaflowVersion); err != nil { return nil, fmt.Errorf("numaflow %s does not satisfy the minimum required by SDK %s: %w", numaflowVersion, sdkVersion, err) } } - if err := checkSDKCompatibility(sdkVersion, serverInfo.Language, minimumSupportedSDKVersions); err != nil { - return nil, fmt.Errorf("SDK %s does not satisfy the minimum required by numaflow %s: %w", - sdkVersion, numaflowVersion, err) + // If Version or Language are empty, skip the SDK compatibility check as there was an + // error writing server info on the SDK side + if sdkVersion == "" || sdkLanguage == "" { + log.Printf("warning: failed to get the SDK version/language, skipping SDK version compatibility check") + } else { + if err := checkSDKCompatibility(sdkVersion, sdkLanguage, minimumSupportedSDKVersions); err != nil { + return nil, fmt.Errorf("SDK %s does not satisfy the minimum required by numaflow %s: %w", + sdkVersion, numaflowVersion, err) + } } return serverInfo, nil