Skip to content

Commit 13c9e4b

Browse files
committed
Detect X.Y.0-rcZ semver in version_fetch.py
After scylladb/scylla-machine-image#359 was merged, naming of RC versions of Scylla was changed from X.Y.rcZ to X.Y.0-rcZ. version_fetch.py script did not detect those versions. Scylla OSS from 5.1 and Scylla Enterprise from 2022.2 use this new naming scheme. Fix the issue by extending the SCYLLA_OSS_RC_VERSION_REGEX and SCYLLA_ENTERPRISE_RC_VERSION_REGEX regexes. Ported from Java Driver 3.x. (commit fcb5e33)
1 parent fac8eab commit 13c9e4b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

ci/version_fetch.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@
2323

2424
SCYLLA_OSS = (DOCKER_HUB_SCYLLA_NAMESPACE, 'scylla')
2525
SCYLLA_OSS_RELEASED_VERSION_REGEX = re.compile(r'(\d+)\.(\d+)\.(\d+)')
26-
SCYLLA_OSS_RC_VERSION_REGEX = re.compile(r'(\d+)\.(\d+)\.rc(\d+)')
26+
SCYLLA_OSS_RC_VERSION_REGEX = re.compile(r'(\d+)\.(\d+)\.(?:0-)?rc(\d+)')
2727

2828
SCYLLA_ENTERPRISE = (DOCKER_HUB_SCYLLA_NAMESPACE, 'scylla-enterprise')
2929
SCYLLA_ENTERPRISE_RELEASED_VERSION_REGEX = re.compile(r'(\d{4})\.(\d+)\.(\d+)')
30-
SCYLLA_ENTERPRISE_RC_VERSION_REGEX = re.compile(r'(\d{4})\.(\d+)\.rc(\d+)')
30+
SCYLLA_ENTERPRISE_RC_VERSION_REGEX = re.compile(
31+
r'(\d{4})\.(\d+)\.(?:0-)?rc(\d+)')
3132

3233
CASSANDRA_ENDPOINT = 'https://dlcdn.apache.org/cassandra/'
3334

@@ -86,7 +87,7 @@ def fetch_all_scylla_oss_rc_versions():
8687
# Download Docker tags for repository
8788
tags_data = fetch_docker_hub_tags(*SCYLLA_OSS)
8889

89-
# Parse only those tags which match 'NUM.NUM.rcNUM'
90+
# Parse only those tags which match 'NUM.NUM.rcNUM' or 'NUM.NUM.0-rcNUM'
9091
# into tuple (NUM, NUM, NUM)
9192
rc_tags_data = filter(SCYLLA_OSS_RC_VERSION_REGEX.fullmatch, tags_data)
9293
rc_tags_data = map(lambda e: SCYLLA_OSS_RC_VERSION_REGEX.match(
@@ -111,7 +112,9 @@ def fetch_all_scylla_oss_rc_versions():
111112
# Filter out those RCs that are obsoleted by released stable version
112113
rc_tags_data = filter(lambda e: (
113114
e[0], e[1]) not in stable_tags_data, rc_tags_data)
114-
rc_tags_data = [f'{e[0]}.{e[1]}.rc{e[2]}' for e in rc_tags_data]
115+
rc_tags_data = [
116+
f'{e[0]}.{e[1]}.0-rc{e[2]}' if (e[0], e[1]) >= (5, 1) else
117+
f'{e[0]}.{e[1]}.rc{e[2]}' for e in rc_tags_data]
115118
return rc_tags_data
116119

117120

@@ -143,7 +146,7 @@ def fetch_all_scylla_enterprise_rc_versions():
143146
# Download Docker tags for repository
144147
tags_data = fetch_docker_hub_tags(*SCYLLA_ENTERPRISE)
145148

146-
# Parse only those tags which match 'YEAR.NUM.rcNUM'
149+
# Parse only those tags which match 'YEAR.NUM.rcNUM' or 'YEAR.NUM.0-rcNUM'
147150
# into tuple (YEAR, NUM, NUM)
148151
rc_tags_data = filter(
149152
SCYLLA_ENTERPRISE_RC_VERSION_REGEX.fullmatch, tags_data)
@@ -168,7 +171,8 @@ def fetch_all_scylla_enterprise_rc_versions():
168171
# Filter out those RCs that are obsoleted by released stable version
169172
rc_tags_data = filter(lambda e: (
170173
e[0], e[1]) not in stable_tags_data, rc_tags_data)
171-
rc_tags_data = [f'{e[0]}.{e[1]}.rc{e[2]}' for e in rc_tags_data]
174+
rc_tags_data = [f'{e[0]}.{e[1]}.0-rc{e[2]}' if (e[0], e[1]) >=
175+
(2022, 2) else f'{e[0]}.{e[1]}.rc{e[2]}' for e in rc_tags_data]
172176
return rc_tags_data
173177

174178

0 commit comments

Comments
 (0)