示例#1
0
def test_with_bazel_at_commit(project_name, platform_name, git_repo_location,
                              bazel_commit):
    http_config = DOWNSTREAM_PROJECTS[project_name]["http_config"]
    return_code = bazelci.main([
        "runner",
        "--platform=" + platform_name,
        "--http_config=" + http_config,
        "--git_repo_location=" + git_repo_location,
        "--use_bazel_at_commit=" + bazel_commit,
    ])
    return return_code == 0
def run_test(repo_location, module_name, module_version, task):
    try:
        return bazelci.main([
            "runner",
            "--task=" + task,
            "--file_config=%s" %
            get_presubmit_yml(module_name, module_version),
            "--repo_location=%s" % repo_location,
        ])
    except subprocess.CalledProcessError as e:
        bazelci.eprint(str(e))
        return 1
def test_with_bazel_at_commit(project_name, platform_name, git_repo_location,
                              bazel_commit, needs_clean):
    http_config = DOWNSTREAM_PROJECTS[project_name]["http_config"]
    try:
        return_code = bazelci.main([
            "runner",
            "--platform=" + platform_name,
            "--http_config=" + http_config,
            "--git_repo_location=" + git_repo_location,
            "--use_bazel_at_commit=" + bazel_commit,
        ] + (["--needs_clean"] if needs_clean else []))
    except subprocess.CalledProcessError as e:
        bazelci.eprint(str(e))
        return False
    return return_code == 0
def test_with_bazel_at_commit(project_name, task_name, git_repo_location,
                              bazel_commit, needs_clean, repeat_times):
    http_config = bazelci.DOWNSTREAM_PROJECTS[project_name]["http_config"]
    for i in range(1, repeat_times + 1):
        if repeat_times > 1:
            bazelci.print_collapsed_group(":bazel: Try %s time" % i)
        try:
            return_code = bazelci.main([
                "runner",
                "--task=" + task_name,
                "--http_config=" + http_config,
                "--git_repo_location=" + git_repo_location,
                "--use_bazel_at_commit=" + bazel_commit,
            ] + (["--needs_clean"] if needs_clean else []))
        except subprocess.CalledProcessError as e:
            bazelci.eprint(str(e))
            return False
        if return_code != 0:
            return False
    return True