Beispiel #1
0
def main():
    args = parse_args()
    config.load_kube_config()
    dev_config = load_config()
    create_kube_config()

    if not args.skip_operator_install:
        build_and_push_operator(
            dev_config.repo_url,
            f"{dev_config.repo_url}/mongodb-kubernetes-operator",
            ".",
        )
        deploy_operator()

    build_and_push_testrunner(dev_config.repo_url,
                              f"{dev_config.repo_url}/{TEST_RUNNER_NAME}", ".")
    build_and_push_e2e(dev_config.repo_url, f"{dev_config.repo_url}/e2e", ".")
    build_and_push_prehook(dev_config.repo_url,
                           f"{dev_config.repo_url}/prehook", ".")

    _prepare_testrunner_environment()

    pod = create_test_runner_pod(args.test)
    corev1 = client.CoreV1Api()

    wait_for_pod_to_be_running(corev1, TEST_RUNNER_NAME, dev_config.namespace)

    # stream all of the pod output as the pod is running
    for line in corev1.read_namespaced_pod_log(
            TEST_RUNNER_NAME,
            dev_config.namespace,
            follow=True,
            _preload_content=False).stream():
        print(line.decode("utf-8").rstrip())
Beispiel #2
0
def build_and_push_images(args: argparse.Namespace,
                          dev_config: DevConfig) -> None:
    test_runner_name = dev_config.testrunner_image
    if args.install_operator:
        build_and_push_operator(
            dev_config.repo_url,
            f"{dev_config.repo_url}/{dev_config.operator_image}:{args.tag}",
            ".",
        )
        deploy_operator()

    if args.build_images:
        build_and_push_testrunner(
            dev_config.repo_url,
            "{}/{}:{}".format(dev_config.repo_url, test_runner_name, args.tag),
            ".",
        )
        build_and_push_e2e(
            dev_config.repo_url,
            "{}/{}:{}".format(dev_config.repo_url, dev_config.e2e_image,
                              args.tag),
            ".",
        )
        build_and_push_version_upgrade_hook(
            dev_config.repo_url,
            "{}/{}:{}".format(dev_config.repo_url,
                              dev_config.version_upgrade_hook_image, args.tag),
            ".",
        )