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

Fix prepare_release.py based on the changes made in Citus repo #242

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
25 changes: 13 additions & 12 deletions packaging_automation/prepare_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
MULTI_EXTENSION_SQL = "src/test/regress/sql/multi_extension.sql"
CITUS_CONTROL = "src/backend/distributed/citus.control"
MULTI_EXTENSION_OUT = "src/test/regress/expected/multi_extension.out"
CONFIG_PY = "src/test/regress/upgrade/config.py"
CONFIG_PY = "src/test/regress/citus_tests/config.py"
DISTRIBUTED_SQL_DIR_PATH = "src/backend/distributed/sql"
DOWNGRADES_DIR_PATH = f"{DISTRIBUTED_SQL_DIR_PATH}/downgrades"
CONFIGURE_IN = "configure.in"
CONFIGURE_AC = "configure.ac"
CONFIGURE = "configure"
CITUS_CONTROL_SEARCH_PATTERN = r"^default_version*"

Expand All @@ -57,9 +57,9 @@
rf"^{MULTI_EXT_DETAIL_PREFIX}\d+\.\d+{MULTI_EXT_DETAIL2_SUFFIX}$"
)

CONFIG_PY_MASTER_VERSION_SEARCH_PATTERN = r"^MASTER_VERSION = '\d+\.\d+'"
CONFIG_PY_MASTER_VERSION_SEARCH_PATTERN = r'^MASTER_VERSION = "\d+\.\d+"'

CONFIGURE_IN_SEARCH_PATTERN = "AC_INIT*"
CONFIGURE_AC_SEARCH_PATTERN = "AC_INIT*"
REPO_OWNER = "citusdata"

BASE_PATH = pathlib2.Path(__file__).parent.absolute()
Expand All @@ -69,7 +69,7 @@
MULTI_EXT_SQL_TEMPLATE_FILE = "multi_extension_sql_prepare_release.tmpl"

repo_details = {
"citus": {"configure-in-str": "Citus", "branch": "master"},
"citus": {"configure-in-str": "Citus", "branch": "main"},
"citus-enterprise": {
"configure-in-str": "Citus Enterprise",
"branch": "enterprise-master",
Expand Down Expand Up @@ -187,7 +187,7 @@ def update_release(
multi_extension_out_path=f"{exec_path}/{MULTI_EXTENSION_OUT}",
multi_extension_sql_path=f"{exec_path}/{MULTI_EXTENSION_SQL}",
citus_control_file_path=f"{exec_path}/{CITUS_CONTROL}",
configure_in_path=f"{exec_path}/{CONFIGURE_IN}",
configure_in_path=f"{exec_path}/{CONFIGURE_AC}",
config_py_path=f"{exec_path}/{CONFIG_PY}",
distributed_dir_path=f"{exec_path}/{DISTRIBUTED_SQL_DIR_PATH}",
downgrades_dir_path=f"{exec_path}/{DOWNGRADES_DIR_PATH}",
Expand Down Expand Up @@ -321,7 +321,7 @@ def prepare_release_branch_for_patch_release(patchReleaseParams: PatchReleasePar
checkout_branch(
patchReleaseParams.release_branch_name, patchReleaseParams.is_test
)
# change version info in configure.in file
# change version info in configure.ac file
update_version_in_configure_in(
patchReleaseParams.project_name,
patchReleaseParams.configure_in_path,
Expand Down Expand Up @@ -368,7 +368,7 @@ def prepare_upcoming_version_branch(upcoming_params: UpcomingVersionBranchParams
checkout_branch(upcoming_params.main_branch, upcoming_params.is_test)
# create master-update-version-$curtime branch
create_and_checkout_branch(upcoming_params.upcoming_version_branch)
# update version info with upcoming version on configure.in
# update version info with upcoming version on configure.ac
update_version_in_configure_in(
upcoming_params.project_name,
upcoming_params.configure_in_path,
Expand Down Expand Up @@ -450,7 +450,7 @@ def prepare_release_branch_for_major_release(majorReleaseParams: MajorReleasePar
checkout_branch(majorReleaseParams.main_branch, majorReleaseParams.is_test)
# create release branch in release-X.Y format
create_and_checkout_branch(majorReleaseParams.release_branch_name)
# change version info in configure.in file
# change version info in configure.ac file
update_version_in_configure_in(
majorReleaseParams.project_name,
majorReleaseParams.configure_in_path,
Expand Down Expand Up @@ -560,12 +560,13 @@ def add_downgrade_script_in_multi_extension_file(

if not prepend_line_in_file(
multi_extension_out_path,
"DROP TABLE prev_objects, extension_diff;",
"DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;",
string_to_prepend,
):
raise ValueError(
f"Downgrade scripts could not be added in {multi_extension_out_path} since "
f"'DROP TABLE prev_objects, extension_diff;' script could not be found "
"'DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;' "
"script could not be found "
)
print(
f"### Done Test downgrade scripts successfully added in {multi_extension_out_path}. ###"
Expand Down Expand Up @@ -696,7 +697,7 @@ def update_version_in_configure_in(project_name, configure_in_path, project_vers
print(f"### Updating version on file {configure_in_path}... ###")
if not replace_line_in_file(
configure_in_path,
CONFIGURE_IN_SEARCH_PATTERN,
CONFIGURE_AC_SEARCH_PATTERN,
f"AC_INIT([{repo_details[project_name]['configure-in-str']}], [{project_version}])",
):
raise ValueError(f"{configure_in_path} does not have match for version")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
ALTER EXTENSION citus UPDATE TO '{{upcoming_minor_version}}';
ALTER EXTENSION citus UPDATE TO '{{current_schema_version}}';
-- Should be empty result since upgrade+downgrade should be a no-op
SELECT * FROM print_extension_changes();
SELECT * FROM multi_extension.print_extension_changes();
previous_object | current_object
---------------------------------------------------------------------
(0 rows)

-- Snapshot of state at {{upcoming_minor_version}}
ALTER EXTENSION citus UPDATE TO '{{upcoming_minor_version}}';
SELECT * FROM print_extension_changes();
SELECT * FROM multi_extension.print_extension_changes();
previous_object | current_object
---------------------------------------------------------------------
(0 rows)
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
ALTER EXTENSION citus UPDATE TO '{{upcoming_minor_version}}';
ALTER EXTENSION citus UPDATE TO '{{current_schema_version}}';
-- Should be empty result since upgrade+downgrade should be a no-op
SELECT * FROM print_extension_changes();
SELECT * FROM multi_extension.print_extension_changes();

-- Snapshot of state at {{upcoming_minor_version}}
ALTER EXTENSION citus UPDATE TO '{{upcoming_minor_version}}';
SELECT * FROM print_extension_changes();
SELECT * FROM multi_extension.print_extension_changes();
8 changes: 4 additions & 4 deletions packaging_automation/tests/test_prepare_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
MULTI_EXTENSION_OUT,
MULTI_EXTENSION_SQL,
CONFIGURE,
CONFIGURE_IN,
CONFIGURE_AC,
CITUS_CONTROL,
CONFIG_PY,
ProjectParams,
Expand Down Expand Up @@ -74,7 +74,7 @@ def test_major_release():

assert file_includes_line(test_base_path_major, MULTI_EXTENSION_OUT, " 10.1.0")
assert file_includes_line(
test_base_path_major, CONFIGURE_IN, "AC_INIT([Citus], [10.1.0])"
test_base_path_major, CONFIGURE_AC, "AC_INIT([Citus], [10.1.0])"
)
assert file_includes_line(
test_base_path_major, CONFIGURE, "PACKAGE_VERSION='10.1.0'"
Expand Down Expand Up @@ -154,7 +154,7 @@ def test_major_release():
test_base_path_major, CONFIG_PY, "MASTER_VERSION = '10.2'"
)
assert file_includes_line(
test_base_path_major, CONFIGURE_IN, "AC_INIT([Citus], [10.2devel])"
test_base_path_major, CONFIGURE_AC, "AC_INIT([Citus], [10.2devel])"
)
assert file_includes_line(
test_base_path_major, CONFIGURE, "PACKAGE_VERSION='10.2devel'"
Expand Down Expand Up @@ -213,7 +213,7 @@ def test_patch_release():
)
assert file_includes_line(
test_base_path_patch,
CONFIGURE_IN,
CONFIGURE_AC,
f"AC_INIT([Citus], [{project_params.project_version}])",
)
assert file_includes_line(
Expand Down