Simplify argument parsing (#459)

With the current state of automation scripts, this is not possible anymore to launch script with multiple auto configs.
This commit is contained in:
Marc Wrobel
2025-07-06 22:42:01 +02:00
committed by GitHub
parent b105939f93
commit 391d65ad8a
61 changed files with 1091 additions and 1032 deletions

View File

@@ -1,7 +1,8 @@
import re
from common import dates, releasedata
from common import dates
from common.git import Git
from common.releasedata import ProductData, config_from_argv
"""Fetches Red Hat OpenShift versions from the documentation's git repository"""
@@ -10,26 +11,26 @@ VERSION_AND_DATE_PATTERN = re.compile(
re.MULTILINE,
)
for config in releasedata.list_configs_from_argv():
with releasedata.ProductData(config.product) as product_data:
git = Git(config.url)
git.setup()
config = config_from_argv()
with ProductData(config.product) as product_data:
git = Git(config.url)
git.setup()
# only fetch v4+ branches, because the format was different in openshift v3
for branch in git.list_branches("refs/heads/enterprise-[4-9]*"):
branch_version = branch.split("-")[1]
file_version = branch_version.replace(".", "-")
release_notes_filename = f"release_notes/ocp-{file_version}-release-notes.adoc"
git.checkout(branch, file_list=[release_notes_filename])
# only fetch v4+ branches, because the format was different in openshift v3
for branch in git.list_branches("refs/heads/enterprise-[4-9]*"):
branch_version = branch.split("-")[1]
file_version = branch_version.replace(".", "-")
release_notes_filename = f"release_notes/ocp-{file_version}-release-notes.adoc"
git.checkout(branch, file_list=[release_notes_filename])
release_notes_file = git.repo_dir / release_notes_filename
if not release_notes_file.exists():
continue
release_notes_file = git.repo_dir / release_notes_filename
if not release_notes_file.exists():
continue
with release_notes_file.open("rb") as f:
content = f.read().decode("utf-8")
for version, date_str in VERSION_AND_DATE_PATTERN.findall(content):
product_data.declare_version(
version.replace("{product-version}", branch_version),
dates.parse_date(date_str),
)
with release_notes_file.open("rb") as f:
content = f.read().decode("utf-8")
for version, date_str in VERSION_AND_DATE_PATTERN.findall(content):
product_data.declare_version(
version.replace("{product-version}", branch_version),
dates.parse_date(date_str),
)