mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Make autogenerated version independent from tweak by default
This commit is contained in:
parent
54d46f2180
commit
ad7ec74009
@ -265,7 +265,11 @@ class Release:
|
|||||||
f"for {self.release_type} release"
|
f"for {self.release_type} release"
|
||||||
)
|
)
|
||||||
|
|
||||||
def _commit_cmake_contributors(self, version: ClickHouseVersion) -> None:
|
def _update_cmake_contributors(
|
||||||
|
self, version: ClickHouseVersion, reset_tweak: bool = True
|
||||||
|
) -> None:
|
||||||
|
if reset_tweak:
|
||||||
|
version = version.reset_tweak()
|
||||||
update_cmake_version(version)
|
update_cmake_version(version)
|
||||||
update_contributors(raise_error=True)
|
update_contributors(raise_error=True)
|
||||||
if self.dry_run:
|
if self.dry_run:
|
||||||
@ -274,9 +278,15 @@ class Release:
|
|||||||
self.run(f"git diff '{self.CMAKE_PATH}' '{self.CONTRIBUTORS_PATH}'"),
|
self.run(f"git diff '{self.CMAKE_PATH}' '{self.CONTRIBUTORS_PATH}'"),
|
||||||
)
|
)
|
||||||
self.run(f"git checkout '{self.CMAKE_PATH}' '{self.CONTRIBUTORS_PATH}'")
|
self.run(f"git checkout '{self.CMAKE_PATH}' '{self.CONTRIBUTORS_PATH}'")
|
||||||
|
|
||||||
|
def _commit_cmake_contributors(
|
||||||
|
self, version: ClickHouseVersion, reset_tweak: bool = True
|
||||||
|
) -> None:
|
||||||
|
if reset_tweak:
|
||||||
|
version = version.reset_tweak()
|
||||||
self.run(
|
self.run(
|
||||||
f"git commit -m 'Update version to {version.string}' "
|
f"git commit '{self.CMAKE_PATH}' '{self.CONTRIBUTORS_PATH}' "
|
||||||
f"'{self.CMAKE_PATH}' '{self.CONTRIBUTORS_PATH}'",
|
f"-m 'Update autogenerated version to {version.string} and contributors'",
|
||||||
dry_run=self.dry_run,
|
dry_run=self.dry_run,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -321,27 +331,12 @@ class Release:
|
|||||||
with self._create_gh_release(False):
|
with self._create_gh_release(False):
|
||||||
self.version = self.version.update(self.release_type)
|
self.version = self.version.update(self.release_type)
|
||||||
self.version.with_description(version_type)
|
self.version.with_description(version_type)
|
||||||
update_cmake_version(self.version)
|
self._update_cmake_contributors(self.version)
|
||||||
update_contributors(raise_error=True)
|
|
||||||
if self.dry_run:
|
|
||||||
logging.info(
|
|
||||||
"Dry running, resetting the following changes in the repo:\n%s",
|
|
||||||
self.run(
|
|
||||||
f"git diff '{self.CMAKE_PATH}' '{self.CONTRIBUTORS_PATH}'"
|
|
||||||
),
|
|
||||||
)
|
|
||||||
self.run(f"git checkout '{self.CMAKE_PATH}' '{self.CONTRIBUTORS_PATH}'")
|
|
||||||
|
|
||||||
# Checkouting the commit of the branch and not the branch itself,
|
# Checkouting the commit of the branch and not the branch itself,
|
||||||
# then we are able to skip rollback
|
# then we are able to skip rollback
|
||||||
with self._checkout(f"{self.release_branch}^0", False):
|
with self._checkout(f"{self.release_branch}^0", False):
|
||||||
current_commit = self.run("git rev-parse HEAD")
|
current_commit = self.run("git rev-parse HEAD")
|
||||||
self.run(
|
self._commit_cmake_contributors(self.version)
|
||||||
f"git commit -m "
|
|
||||||
f"'Update version to {self.version.string}' "
|
|
||||||
f"'{self.CMAKE_PATH}' '{self.CONTRIBUTORS_PATH}'",
|
|
||||||
dry_run=self.dry_run,
|
|
||||||
)
|
|
||||||
with self._push(
|
with self._push(
|
||||||
"HEAD", with_rollback_on_fail=False, remote_ref=self.release_branch
|
"HEAD", with_rollback_on_fail=False, remote_ref=self.release_branch
|
||||||
):
|
):
|
||||||
@ -406,6 +401,7 @@ class Release:
|
|||||||
if version_type == VersionType.LTS:
|
if version_type == VersionType.LTS:
|
||||||
pr_labels += " --label release-lts"
|
pr_labels += " --label release-lts"
|
||||||
new_version.with_description(version_type)
|
new_version.with_description(version_type)
|
||||||
|
self._update_cmake_contributors(new_version)
|
||||||
self._commit_cmake_contributors(new_version)
|
self._commit_cmake_contributors(new_version)
|
||||||
with self._push(self.release_branch):
|
with self._push(self.release_branch):
|
||||||
with self._create_gh_label(
|
with self._create_gh_label(
|
||||||
@ -434,6 +430,7 @@ class Release:
|
|||||||
self.read_version()
|
self.read_version()
|
||||||
self.version = self.version.update(self.release_type)
|
self.version = self.version.update(self.release_type)
|
||||||
self.version.with_description(VersionType.TESTING)
|
self.version.with_description(VersionType.TESTING)
|
||||||
|
self._update_cmake_contributors(self.version)
|
||||||
self._commit_cmake_contributors(self.version)
|
self._commit_cmake_contributors(self.version)
|
||||||
with self._push(helper_branch):
|
with self._push(helper_branch):
|
||||||
body_file = get_abs_path(".github/PULL_REQUEST_TEMPLATE.md")
|
body_file = get_abs_path(".github/PULL_REQUEST_TEMPLATE.md")
|
||||||
|
@ -88,6 +88,13 @@ class ClickHouseVersion:
|
|||||||
self.major, self.minor, self.patch + 1, self.revision, self._git
|
self.major, self.minor, self.patch + 1, self.revision, self._git
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def reset_tweak(self) -> "ClickHouseVersion":
|
||||||
|
if self._git is not None:
|
||||||
|
self._git.update()
|
||||||
|
return ClickHouseVersion(
|
||||||
|
self.major, self.minor, self.patch, self.revision, self._git, "1"
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def major(self) -> int:
|
def major(self) -> int:
|
||||||
return self._major
|
return self._major
|
||||||
|
Loading…
Reference in New Issue
Block a user