Esempio n. 1
0
    temp_path = os.getenv("TEMP_PATH", os.path.abspath("."))
    repo_path = os.getenv("REPO_COPY", os.path.abspath("../../"))
    reports_path = os.getenv("REPORTS_PATH", "./reports")

    check_name = sys.argv[1]

    if not os.path.exists(temp_path):
        os.makedirs(temp_path)

    is_flaky_check = 'flaky' in check_name
    pr_info = PRInfo(get_event(), need_changed_files=is_flaky_check)

    gh = Github(get_best_robot_token())

    images = get_images_with_versions(temp_path, IMAGES)
    images_with_versions = {i.name: i.version for i in images}
    result_path = os.path.join(temp_path, "output_dir")
    if not os.path.exists(result_path):
        os.makedirs(result_path)

    work_path = os.path.join(temp_path, "workdir")
    if not os.path.exists(work_path):
        os.makedirs(work_path)

    build_path = os.path.join(temp_path, "build")
    if not os.path.exists(build_path):
        os.makedirs(build_path)

    download_all_deb_packages(check_name, reports_path, build_path)
    temp_path = TEMP_PATH
    repo_path = REPO_COPY
    reports_path = REPORTS_PATH

    pr_info = PRInfo()

    gh = Github(get_best_robot_token())

    rerun_helper = RerunHelper(gh, pr_info, CHECK_NAME)
    if rerun_helper.is_already_finished_by_status():
        logging.info(
            "Check is already finished according to github status, exiting")
        sys.exit(0)

    docker_images = get_images_with_versions(reports_path,
                                             [IMAGE_CENTOS, IMAGE_UBUNTU])

    packages_path = os.path.join(temp_path, "packages")
    if not os.path.exists(packages_path):
        os.makedirs(packages_path)

    def url_filter(url):
        return url.endswith(".deb") and ("clickhouse-common-static_" in url
                                         or "clickhouse-server_" in url)

    download_builds_filter(CHECK_NAME, reports_path, packages_path, url_filter)

    for f in os.listdir(packages_path):
        if ".deb" in f:
            full_path = os.path.join(packages_path, f)
            subprocess.check_call(
        check_name_with_group = check_name

    if not os.path.exists(temp_path):
        os.makedirs(temp_path)

    is_flaky_check = 'flaky' in check_name
    pr_info = PRInfo(need_changed_files=is_flaky_check)

    gh = Github(get_best_robot_token())

    rerun_helper = RerunHelper(gh, pr_info, check_name_with_group)
    if rerun_helper.is_already_finished_by_status():
        logging.info("Check is already finished according to github status, exiting")
        sys.exit(0)

    images = get_images_with_versions(reports_path, IMAGES)
    images_with_versions = {i.name: i.version for i in images}
    result_path = os.path.join(temp_path, "output_dir")
    if not os.path.exists(result_path):
        os.makedirs(result_path)

    work_path = os.path.join(temp_path, "workdir")
    if not os.path.exists(work_path):
        os.makedirs(work_path)

    build_path = os.path.join(temp_path, "build")
    if not os.path.exists(build_path):
        os.makedirs(build_path)

    download_all_deb_packages(check_name, reports_path, build_path)