Skip to content

Commit

Permalink
chore: skip sdk compatibility check if server info does not contain s…
Browse files Browse the repository at this point in the history
…dk version (#1703)

Signed-off-by: a3hadi <[email protected]>
  • Loading branch information
ayildirim21 authored and whynowy committed Apr 24, 2024
1 parent 4251fbb commit 49eed41
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions pkg/sdkclient/serverinfo/serverinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 49eed41

Please sign in to comment.