From f436d89781276e58d6430a2aac6b19fb3c030005 Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Thu, 23 May 2024 15:04:28 -0400 Subject: [PATCH 1/2] adjusting the validation for branch updates Signed-off-by: Francisco Javier Arceo --- infra/scripts/release/bump_file_versions.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/infra/scripts/release/bump_file_versions.py b/infra/scripts/release/bump_file_versions.py index e17463c2c7b..c7cfe26ce8b 100644 --- a/infra/scripts/release/bump_file_versions.py +++ b/infra/scripts/release/bump_file_versions.py @@ -1,5 +1,6 @@ # This script will bump the versions found in files (charts, pom.xml) during the Feast release process. +import re import pathlib import sys @@ -73,11 +74,20 @@ def validate_files_to_bump(current_version, files_to_bump, repo_root): with open(repo_root.joinpath(file_path), "r") as f: file_contents = f.readlines() for line in lines: - assert current_version in file_contents[int(line) - 1], ( + new_version = _get_semantic_version(file_contents[int(line) - 1]) + current_major_minor_version = '.'.join(current_version.split(".")[0:1]) + assert current_version in new_version or current_major_minor_version in new_version, ( f"File `{file_path}` line `{line}` didn't contain version {current_version}. " f"Contents: {file_contents[int(line) - 1]}" ) + +def _get_semantic_version(input_string: str) -> str: + semver_pattern = r'\bv?(\d+\.\d+\.\d+)\b' + match = re.search(semver_pattern, input_string) + return match.group(1) + + if __name__ == "__main__": main() From 054eacac328598b0133bbc9b7b1c0c9e35eb7580 Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Fri, 24 May 2024 05:58:37 -0400 Subject: [PATCH 2/2] updated to get parsed version Signed-off-by: Francisco Javier Arceo --- infra/scripts/release/bump_file_versions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/infra/scripts/release/bump_file_versions.py b/infra/scripts/release/bump_file_versions.py index c7cfe26ce8b..c913e9f43f7 100644 --- a/infra/scripts/release/bump_file_versions.py +++ b/infra/scripts/release/bump_file_versions.py @@ -46,7 +46,9 @@ def main() -> None: with open(repo_root.joinpath(file_path), "r") as f: file_contents = f.readlines() for line in lines: - file_contents[int(line) - 1] = file_contents[int(line) - 1].replace(current_version, new_version) + # note we validate the version above already + current_parsed_version = _get_semantic_version(file_contents[int(line) - 1]) + file_contents[int(line) - 1] = file_contents[int(line) - 1].replace(current_parsed_version, new_version) with open(repo_root.joinpath(file_path), "w") as f: f.write(''.join(file_contents)) @@ -82,7 +84,6 @@ def validate_files_to_bump(current_version, files_to_bump, repo_root): ) - def _get_semantic_version(input_string: str) -> str: semver_pattern = r'\bv?(\d+\.\d+\.\d+)\b' match = re.search(semver_pattern, input_string)