Skip to content

Commit a756fb0

Browse files
authored
fix: SGW 4.0.0 shown as 0.0.0 + keep all-fail runs (#388)
* fix: SGW 4.0.0 shown as 0.0.0 + keep all-fail runs * fix: remove sgw all fail upload condition
1 parent 945d8d9 commit a756fb0

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

client/src/cbltest/greenboarduploader.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,22 @@ def upload(self, platform: str, os_name: str, version: str, sgw_version: str):
6767
cbl_warning("Overall result is failure, skipping upload...")
6868
return
6969

70-
version_components = version.split("-")
71-
if len(version_components) != 2:
72-
version = "0.0.0"
73-
build = 0
74-
else:
75-
version = version_components[0]
76-
build = int(version_components[1].lstrip("b"))
70+
version_to_parse = sgw_version if platform == "sync-gateway" else version
71+
version_components = version_to_parse.split("-")
72+
73+
parsed_version = "0.0.0"
74+
parsed_build = 0
75+
76+
if len(version_components) > 0 and version_components[0]:
77+
parsed_version = version_components[0]
78+
79+
if len(version_components) > 1:
80+
try:
81+
# Handles build numbers like 'b1234' or just '1234'
82+
parsed_build = int(version_components[1].lstrip("b"))
83+
except ValueError:
84+
# If the part after '-' is not a number, build remains 0
85+
cbl_warning(f"Could not parse build number from '{version_to_parse}'")
7786

7887
auth = PasswordAuthenticator(self.__username, self.__password)
7988
opts = ClusterOptions(auth)
@@ -87,8 +96,8 @@ def upload(self, platform: str, os_name: str, version: str, sgw_version: str):
8796
cluster.bucket("greenboard").default_collection().upsert(
8897
str(uuid4()),
8998
{
90-
"build": build,
91-
"version": version,
99+
"build": parsed_build,
100+
"version": parsed_version,
92101
"sgwVersion": sgw_version,
93102
"failCount": self.__fail_count,
94103
"passCount": self.__pass_count,

0 commit comments

Comments
 (0)