def setUp(self): """we use dummy git object""" run_patcher = patch("git_helper.Runner.run", return_value="") self.run_mock = run_patcher.start() self.addCleanup(run_patcher.stop) update_patcher = patch("git_helper.Git.update") update_mock = update_patcher.start() self.addCleanup(update_patcher.stop) self.git = Git() update_mock.assert_called_once() self.run_mock.assert_called_once() self.git.new_branch = "NEW_BRANCH_NAME" self.git.new_tag = "v21.12.333.22222-stable" self.git.branch = "old_branch" self.git.sha = "" self.git.sha_short = "" self.git.latest_tag = "" self.git.description = "" self.git.commits_since_tag = 0
from get_robot_token import get_best_robot_token, get_parameter_from_ssm from git_helper import Git from pr_info import PRInfo from s3_helper import S3Helper from stopwatch import Stopwatch from upload_result_helper import upload_results from version_helper import ( ClickHouseVersion, get_tagged_versions, get_version_from_repo, version_arg, ) TEMP_PATH = p.join(RUNNER_TEMP, "docker_images_check") BUCKETS = {"amd64": "package_release", "arm64": "package_aarch64"} git = Git(ignore_no_tags=True) class DelOS(argparse.Action): def __call__(self, _, namespace, __, option_string=None): no_build = self.dest[3:] if self.dest.startswith("no_") else self.dest if no_build in namespace.os: namespace.os.remove(no_build) def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter, description="A program to build clickhouse-server image, both alpine and " "ubuntu versions", )
VERSIONS_TEMPLATE = """# This variables autochanged by release_lib.sh: # NOTE: has nothing common with DBMS_TCP_PROTOCOL_VERSION, # only DBMS_TCP_PROTOCOL_VERSION should be incremented on protocol changes. SET(VERSION_REVISION {revision}) SET(VERSION_MAJOR {major}) SET(VERSION_MINOR {minor}) SET(VERSION_PATCH {patch}) SET(VERSION_GITHASH {githash}) SET(VERSION_DESCRIBE {describe}) SET(VERSION_STRING {string}) # end of autochange """ git = Git() class ClickHouseVersion: """Immutable version class. On update returns a new instance""" def __init__( self, major: Union[int, str], minor: Union[int, str], patch: Union[int, str], revision: Union[int, str], git: Git, tweak: str = None, ): self._major = int(major) self._minor = int(minor)
def get_version_from_tag(tag: str) -> ClickHouseVersion: Git.check_tag(tag) tag = tag[1:].split("-")[0] return get_version_from_string(tag)