diff --git a/tests/ci/docker_images_check.py b/tests/ci/docker_images_check.py index 140ede3067f..818478f6430 100644 --- a/tests/ci/docker_images_check.py +++ b/tests/ci/docker_images_check.py @@ -349,14 +349,20 @@ def parse_args() -> argparse.Namespace: help="list of image paths to build instead of using pr_info + diff URL, " "e.g. 'docker/packager/binary'", ) + parser.add_argument("--reports", default=True, help=argparse.SUPPRESS) parser.add_argument( "--no-reports", - action="store_true", + action="store_false", + dest="reports", + default=argparse.SUPPRESS, help="don't push reports to S3 and github", ) + parser.add_argument("--push", default=True, help=argparse.SUPPRESS) parser.add_argument( "--no-push-images", - action="store_true", + action="store_false", + dest="push", + default=argparse.SUPPRESS, help="don't push images to docker hub", ) @@ -375,8 +381,7 @@ def main(): else: changed_json = os.path.join(TEMP_PATH, "changed_images.json") - push = not args.no_push_images - if push: + if args.push: subprocess.check_output( # pylint: disable=unexpected-keyword-arg "docker login --username 'robotclickhouse' --password-stdin", input=get_parameter_from_ssm("dockerhub_robot_password"), @@ -408,7 +413,7 @@ def main(): images_processing_result = [] for image in changed_images: images_processing_result += process_image_with_parents( - image, image_versions, push + image, image_versions, args.push ) result_images[image.repo] = result_version @@ -437,7 +442,7 @@ def main(): print(f"::notice ::Report url: {url}") print(f'::set-output name=url_output::"{url}"') - if args.no_reports: + if not args.reports: return gh = Github(get_best_robot_token()) diff --git a/tests/ci/docker_manifests_merge.py b/tests/ci/docker_manifests_merge.py index 82d012bfe1a..c68ce1e6793 100644 --- a/tests/ci/docker_manifests_merge.py +++ b/tests/ci/docker_manifests_merge.py @@ -44,14 +44,20 @@ def parse_args() -> argparse.Namespace: default=RUNNER_TEMP, help="path to changed_images_*.json files", ) + parser.add_argument("--reports", default=True, help=argparse.SUPPRESS) parser.add_argument( "--no-reports", - action="store_true", + action="store_false", + dest="reports", + default=argparse.SUPPRESS, help="don't push reports to S3 and github", ) + parser.add_argument("--push", default=True, help=argparse.SUPPRESS) parser.add_argument( "--no-push-images", - action="store_true", + action="store_false", + dest="push", + default=argparse.SUPPRESS, help="don't push images to docker hub", ) @@ -167,8 +173,7 @@ def main(): stopwatch = Stopwatch() args = parse_args() - push = not args.no_push_images - if push: + if args.push: subprocess.check_output( # pylint: disable=unexpected-keyword-arg "docker login --username 'robotclickhouse' --password-stdin", input=get_parameter_from_ssm("dockerhub_robot_password"), @@ -189,7 +194,7 @@ def main(): test_results = [] # type: List[Tuple[str, str]] for image, versions in merged.items(): for tags in versions: - manifest, test_result = create_manifest(image, tags, push) + manifest, test_result = create_manifest(image, tags, args.push) test_results.append((manifest, test_result)) if test_result != "OK": status = "failure" @@ -205,7 +210,7 @@ def main(): print("::notice ::Report url: {}".format(url)) print('::set-output name=url_output::"{}"'.format(url)) - if args.no_reports: + if not args.reports: return if changed_images: diff --git a/tests/ci/push_to_artifactory.py b/tests/ci/push_to_artifactory.py index 1f2ea139a6e..2ba47b89535 100755 --- a/tests/ci/push_to_artifactory.py +++ b/tests/ci/push_to_artifactory.py @@ -253,15 +253,21 @@ def parse_args() -> argparse.Namespace: default="https://clickhousedb.jfrog.io/artifactory", help="SaaS Artifactory url", ) + parser.add_argument("--artifactory", default=True, help=argparse.SUPPRESS) parser.add_argument( "-n", "--no-artifactory", - action="store_true", + action="store_false", + dest="artifactory", + default=argparse.SUPPRESS, help="do not push packages to artifactory", ) + parser.add_argument("--force-download", default=True, help=argparse.SUPPRESS) parser.add_argument( "--no-force-download", - action="store_true", + action="store_false", + dest="force_download", + default=argparse.SUPPRESS, help="do not download packages again if they exist already", ) @@ -303,10 +309,10 @@ def main(): args.commit, args.check_name, args.release.version, - not args.no_force_download, + args.force_download, ) art_client = None - if not args.no_artifactory: + if args.artifactory: art_client = Artifactory(args.artifactory_url, args.release.type) if args.deb: diff --git a/tests/ci/release.py b/tests/ci/release.py index b1ce850d640..4ffb04b0aae 100755 --- a/tests/ci/release.py +++ b/tests/ci/release.py @@ -78,21 +78,21 @@ class Release: self._git.update() self.version = get_version_from_repo() - def do(self, no_check_dirty: bool, no_check_branch: bool, no_prestable: bool): + def do(self, check_dirty: bool, check_branch: bool, with_prestable: bool): - if not no_check_dirty: + if check_dirty: logging.info("Checking if repo is clean") self.run("git diff HEAD --exit-code") self.set_release_branch() - if not no_check_branch: + if check_branch: self.check_branch() with self._checkout(self.release_commit, True): if self.release_type in self.BIG: # Checkout to the commit, it will provide the correct current version - if no_prestable: + if with_prestable: logging.info("Skipping prestable stage") else: with self.prestable(): @@ -405,28 +405,38 @@ def parse_args() -> argparse.Namespace: dest="release_type", help="a release type, new branch is created only for 'major' and 'minor'", ) - parser.add_argument( - "--no-prestable", - action="store_true", - help=f"for release types in {Release.BIG} skip creating prestable release and " - "release branch", - ) parser.add_argument( "--commit", default=git.sha, type=commit, help="commit create a release, default to HEAD", ) + parser.add_argument("--with-prestable", default=True, help=argparse.SUPPRESS) + parser.add_argument( + "--no-prestable", + dest="with_prestable", + action="store_false", + default=argparse.SUPPRESS, + help=f"if set, for release types in {Release.BIG} skip creating prestable " + "release and release branch", + ) + parser.add_argument("--check-dirty", default=True, help=argparse.SUPPRESS) parser.add_argument( "--no-check-dirty", - action="store_true", - help="(dangerous) skip check repository for uncommited changes", + dest="check_dirty", + action="store_false", + default=argparse.SUPPRESS, + help="(dangerous) if set, skip check repository for uncommited changes", ) + parser.add_argument("--check-branch", default=True, help=argparse.SUPPRESS) parser.add_argument( "--no-check-branch", - action="store_true", - help="(debug or development only) by default, 'major' and 'minor' types work " - "only for master, and 'patch' works only for a release branches, that name " + dest="check_branch", + action="store_false", + default=argparse.SUPPRESS, + help="(debug or development only) if set, skip the branch check for a run. " + "By default, 'major' and 'minor' types workonly for master, and 'patch' works " + "only for a release branches, that name " "should be the same as '$MAJOR.$MINOR' version, e.g. 22.2", ) @@ -439,7 +449,7 @@ def main(): repo = Repo(args.repo, args.remote_protocol) release = Release(repo, args.commit, args.release_type) - release.do(args.no_check_dirty, args.no_check_branch, args.no_prestable) + release.do(args.check_dirty, args.check_branch, args.with_prestable) if __name__ == "__main__":