Skip to content

Commit d822759

Browse files
committed
Add support for redis-data-integration
1 parent 58bcac7 commit d822759

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

build/release_archiver.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ class VersionArchiver:
55
def __init__(self, product, version):
66
self.product = product
77
self.new_version = version
8-
self.new_directory = f"content/operate/{self.product}/{self.new_version}"
9-
self.latest = f"content/operate/{self.product}"
8+
9+
if self.product in ("kubernetes", "rs"):
10+
self.prefix = "operate"
11+
else:
12+
self.prefix = "integrate"
13+
self.new_directory = f"content/{self.prefix}/{self.product}/{self.new_version}"
14+
self.latest = f"content/{self.prefix}/{self.product}"
1015

1116
def archive_version(self):
1217
"""Copy all files from latest in new versioned directory, excluding release-notes"""
@@ -36,9 +41,12 @@ def update_relrefs(self, file_path, version, product):
3641

3742
# Define a pattern to match relref links dynamically using product
3843
pattern = (
39-
r'(\(\{\{< ?relref "/operate/' + re.escape(product) + r'/([^"]+)" ?>\}\})'
44+
r'(\(\{\{< ?relref "/'
45+
+ self.prefix
46+
+ "/"
47+
+ re.escape(product)
48+
+ r'/([^"]+)" ?>\}\})'
4049
)
41-
4250
with open(file_path, "r") as file:
4351
lines = file.readlines()
4452

@@ -54,11 +62,12 @@ def replace_link(match):
5462
# Check if the link contains 'release-notes' and whether the replacement has already happened
5563
if (
5664
"release-notes" not in link
57-
and f"/operate/{product}/{version}" not in link
65+
and f"/{self.prefix}/{product}/{version}" not in link
5866
):
5967
# Otherwise, replace it
6068
new_link = link.replace(
61-
f"/operate/{product}/", f"/operate/{product}/{version}/"
69+
f"/{self.prefix}/{product}/",
70+
f"/{self.prefix}/{product}/{version}/",
6271
)
6372
return f"{new_link}"
6473
return full_match
@@ -170,8 +179,10 @@ def inject_url_frontmatter(self):
170179

171180
def validate_product(value):
172181
"""Custom validator for product argument to allow only 'rs' or 'kubernetes'"""
173-
if value not in ["rs", "kubernetes"]:
174-
raise argparse.ArgumentTypeError("Product must be either 'rs' or 'kubernetes'.")
182+
if value not in ["rs", "kubernetes", "redis-data-integration"]:
183+
raise argparse.ArgumentTypeError(
184+
"Product must be either 'rs' or 'kubernetes' or 'redis-data-integration'."
185+
)
175186
return value
176187

177188

@@ -193,7 +204,7 @@ def validate_version(value):
193204
parser.add_argument(
194205
"product",
195206
type=validate_product,
196-
help="The name of the product (e.g., rs, kubernetes)",
207+
help="The name of the product (e.g., rs, kubernetes, redis-data-integration)",
197208
)
198209
parser.add_argument(
199210
"version",

0 commit comments

Comments
 (0)