Skip to content

Commit fcb5e33

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.
1 parent 229ef24 commit fcb5e33

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
@@ -25,11 +25,12 @@
2525

2626
SCYLLA_OSS = (DOCKER_HUB_SCYLLA_NAMESPACE, 'scylla')
2727
SCYLLA_OSS_RELEASED_VERSION_REGEX = re.compile(r'(\d+)\.(\d+)\.(\d+)')
28-
SCYLLA_OSS_RC_VERSION_REGEX = re.compile(r'(\d+)\.(\d+)\.rc(\d+)')
28+
SCYLLA_OSS_RC_VERSION_REGEX = re.compile(r'(\d+)\.(\d+)\.(?:0-)?rc(\d+)')
2929

3030
SCYLLA_ENTERPRISE = (DOCKER_HUB_SCYLLA_NAMESPACE, 'scylla-enterprise')
3131
SCYLLA_ENTERPRISE_RELEASED_VERSION_REGEX = re.compile(r'(\d{4})\.(\d+)\.(\d+)')
32-
SCYLLA_ENTERPRISE_RC_VERSION_REGEX = re.compile(r'(\d{4})\.(\d+)\.rc(\d+)')
32+
SCYLLA_ENTERPRISE_RC_VERSION_REGEX = re.compile(
33+
r'(\d{4})\.(\d+)\.(?:0-)?rc(\d+)')
3334

3435
CASSANDRA_ENDPOINT = 'https://dlcdn.apache.org/cassandra/'
3536

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

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

118121

@@ -144,7 +147,7 @@ def fetch_all_scylla_enterprise_rc_versions():
144147
# Download Docker tags for repository
145148
tags_data = fetch_docker_hub_tags(*SCYLLA_ENTERPRISE)
146149

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

175179

0 commit comments

Comments
 (0)