Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{CI} Fix script re for version extract #7649

Merged
merged 2 commits into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions scripts/ci/release_version_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ def extract_module_version_update_info(mod_update_info, mod):
"""
mod_update_info["setup_updated"] = False
module_setup_update_pattern = re.compile(r"\+\+\+.*?src/%s/setup.py" % mod)
module_version_update_pattern = re.compile(r"\+.*?VERSION.*?\=.*?[\'\"]([0-9\.b]+)[\'\"]")
module_version_update_pattern = re.compile(r"\+\s?VERSION\s?\=\s?[\'\"]([0-9\.b]+)[\'\"]")
with open(diff_code_file, "r") as f:
for line in f:
if mod_update_info["setup_updated"]:
if line.find("---") != -1 or mod_update_info.get("version_diff", None):
if line.find("---") == 0 or mod_update_info.get("version_diff", None):
break
mod_version_update_match = re.findall(module_version_update_pattern, line)
if mod_version_update_match and len(mod_version_update_match) == 1:
Expand Down Expand Up @@ -93,7 +93,7 @@ def extract_module_metadata_update_info(mod_update_info, mod):
with open(diff_code_file, "r") as f:
for line in f:
if mod_update_info["meta_updated"]:
if line.find("---") != -1:
if line.find("---") == 0:
break
ispreview_add_match = re.findall(module_ispreview_add_pattern, line)
if ispreview_add_match and len(ispreview_add_match):
Expand Down Expand Up @@ -226,7 +226,7 @@ def gen_preview_comment_message(mod, mod_update_info, mod_message):
if mod_update_info.get("preview_tag", "-") == mod_update_info.get("preview_tag_diff", "-"):
return
preview_comment_message = " - "
if mod_update_info["setup_updated"]:
if mod_update_info["setup_updated"] and mod_update_info.get("version_diff", None):
block_pr = 1
preview_comment_message += ":warning: "
if mod_update_info.get("preview_tag", None) and mod_update_info.get("preview_tag_diff", None):
Expand Down Expand Up @@ -317,11 +317,13 @@ def main():
if len(changed_module_list) == 0:
comment_message.append("For more info about extension versioning, please refer to [Extension version schema](https://github.com/Azure/azure-cli/blob/release/doc/extensions/versioning_guidelines.md)")
save_comment_message(output_file, comment_message)
save_gh_output()
return
fill_module_update_info(modules_update_info)
if len(modules_update_info) == 0:
comment_message.append("For more info about extension versioning, please refer to [Extension version schema](https://github.com/Azure/azure-cli/blob/release/doc/extensions/versioning_guidelines.md)")
save_comment_message(output_file, comment_message)
save_gh_output()
return
for mod, update_info in modules_update_info.items():
gen_comment_message(mod, update_info, comment_message)
Expand Down
Loading