From 8db85b3e079d4df38bb8155bc75ec9129a5752e4 Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Tue, 31 Mar 2020 19:16:37 -0700 Subject: [PATCH 1/4] Add --path_to_server_binary arg for prebuilt images --- tools/run_tests/run_xds_tests.py | 51 +++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/tools/run_tests/run_xds_tests.py b/tools/run_tests/run_xds_tests.py index 3f9fab3c806..c770f17d735 100755 --- a/tools/run_tests/run_xds_tests.py +++ b/tools/run_tests/run_xds_tests.py @@ -142,6 +142,11 @@ argp.add_argument('--xds_server', argp.add_argument('--source_image', default='projects/debian-cloud/global/images/family/debian-9', help='Source image for VMs created during the test') +argp.add_argument('--path_to_server_binary', + default=None, + type=str, + help='If set, the server binary must already be pre-built on ' + 'the specified source image') argp.add_argument('--machine_type', default='e2-standard-2', help='Machine type for VMs created during the test') @@ -473,7 +478,27 @@ def test_secondary_locality_gets_requests_on_primary_failure( patch_backend_instances(gcp, backend_service, [primary_instance_group]) -def create_instance_template(gcp, name, network, source_image, machine_type): +def get_startup_script(path_to_server_binary, service_port): + if path_to_server_binary: + return "nohup %s --port=%d 1>/dev/null &" % (path_to_server_binary, + service_port) + else: + return """#!/bin/bash +sudo apt update +sudo apt install -y git default-jdk +mkdir java_server +pushd java_server +git clone https://github.com/grpc/grpc-java.git +pushd grpc-java +pushd interop-testing +../gradlew installDist -x test -PskipCodegen=true -PskipAndroid=true + +nohup build/install/grpc-interop-testing/bin/xds-test-server \ + --port=%d 1>/dev/null &""" % service_port + + +def create_instance_template(gcp, name, network, source_image, machine_type, + startup_script): config = { 'name': name, 'properties': { @@ -499,21 +524,8 @@ def create_instance_template(gcp, name, network, source_image, machine_type): }], 'metadata': { 'items': [{ - 'key': - 'startup-script', - 'value': - """#!/bin/bash -sudo apt update -sudo apt install -y git default-jdk -mkdir java_server -pushd java_server -git clone https://github.com/grpc/grpc-java.git -pushd grpc-java -pushd interop-testing -../gradlew installDist -x test -PskipCodegen=true -PskipAndroid=true - -nohup build/install/grpc-interop-testing/bin/xds-test-server --port=%d 1>/dev/null &""" - % gcp.service_port + 'key': 'startup-script', + 'value': startup_script }] } } @@ -949,7 +961,7 @@ try: service_host_name = _BASE_SERVICE_HOST + args.gcp_suffix target_http_proxy_name = _BASE_TARGET_PROXY_NAME + args.gcp_suffix forwarding_rule_name = _BASE_FORWARDING_RULE_NAME + args.gcp_suffix - template_name = _BASE_TARGET_PROXY_NAME + args.gcp_suffix + template_name = _BASE_TEMPLATE_NAME + args.gcp_suffix instance_group_name = _BASE_INSTANCE_GROUP_NAME + args.gcp_suffix same_zone_instance_group_name = _BASE_INSTANCE_GROUP_NAME + '-same-zone' + args.gcp_suffix if _USE_SECONDARY_IG: @@ -986,8 +998,11 @@ try: if not gcp.service_port: raise Exception( 'Failed to find a valid ip:port for the forwarding rule') + startup_script = get_startup_script(args.path_to_server_binary, + gcp.service_port) create_instance_template(gcp, template_name, args.network, - args.source_image, args.machine_type) + args.source_image, args.machine_type, + startup_script) instance_group = add_instance_group(gcp, args.zone, instance_group_name, _INSTANCE_GROUP_SIZE) patch_backend_instances(gcp, backend_service, [instance_group]) From 425f04caac95e3a186b65becb9ab7b2923e41b6e Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Wed, 1 Apr 2020 11:26:17 -0700 Subject: [PATCH 2/4] Use prebuilt server image in xds kokokoro job --- tools/internal_ci/linux/grpc_xds_bazel_python_test_in_docker.sh | 2 ++ tools/internal_ci/linux/grpc_xds_bazel_test_in_docker.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tools/internal_ci/linux/grpc_xds_bazel_python_test_in_docker.sh b/tools/internal_ci/linux/grpc_xds_bazel_python_test_in_docker.sh index 0dbea2f59ee..8a1a200b249 100755 --- a/tools/internal_ci/linux/grpc_xds_bazel_python_test_in_docker.sh +++ b/tools/internal_ci/linux/grpc_xds_bazel_python_test_in_docker.sh @@ -51,6 +51,8 @@ GRPC_VERBOSITY=debug GRPC_TRACE=xds_client,xds_resolver,cds_lb,xds_lb "$PYTHON" tools/run_tests/run_xds_tests.py \ --test_case=all \ --project_id=grpc-testing \ + --source_image=projects/grpc-testing/global/images/xds-test-server \ + --path_to_server_binary=/java_server/grpc-java/interop-testing/build/install/grpc-interop-testing/bin/xds-test-server \ --gcp_suffix=$(date '+%s') \ --verbose \ --client_cmd='bazel run //src/python/grpcio_tests/tests_py3_only/interop:xds_interop_client -- --server=xds-experimental:///{server_uri} --stats_port={stats_port} --qps={qps} --verbose' diff --git a/tools/internal_ci/linux/grpc_xds_bazel_test_in_docker.sh b/tools/internal_ci/linux/grpc_xds_bazel_test_in_docker.sh index 17380860f21..03587d76a0c 100755 --- a/tools/internal_ci/linux/grpc_xds_bazel_test_in_docker.sh +++ b/tools/internal_ci/linux/grpc_xds_bazel_test_in_docker.sh @@ -51,6 +51,8 @@ GRPC_VERBOSITY=debug GRPC_TRACE=xds_client,xds_resolver,cds_lb,xds_lb "$PYTHON" tools/run_tests/run_xds_tests.py \ --test_case=all \ --project_id=grpc-testing \ + --source_image=projects/grpc-testing/global/images/xds-test-server \ + --path_to_server_binary=/java_server/grpc-java/interop-testing/build/install/grpc-interop-testing/bin/xds-test-server \ --gcp_suffix=$(date '+%s') \ --verbose \ --client_cmd='bazel-bin/test/cpp/interop/xds_interop_client --server=xds-experimental:///{server_uri} --stats_port={stats_port} --qps={qps}' From 936ab4da4f134c2133374d23ff263324c2943796 Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Wed, 1 Apr 2020 11:31:19 -0700 Subject: [PATCH 3/4] to revert: run on kokoro --- tools/internal_ci/linux/grpc_python_bazel_test.cfg | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/internal_ci/linux/grpc_python_bazel_test.cfg b/tools/internal_ci/linux/grpc_python_bazel_test.cfg index feae924330e..107404a30e9 100644 --- a/tools/internal_ci/linux/grpc_python_bazel_test.cfg +++ b/tools/internal_ci/linux/grpc_python_bazel_test.cfg @@ -1,4 +1,4 @@ -# Copyright 2018 gRPC authors. +# Copyright 2020 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,9 +15,15 @@ # Config file for the internal CI (in protobuf text format) # Location of the continuous shell script in repository. -build_file: "grpc/tools/internal_ci/linux/grpc_bazel.sh" -timeout_mins: 240 +build_file: "grpc/tools/internal_ci/linux/grpc_xds.sh" +timeout_mins: 90 env_vars { key: "BAZEL_SCRIPT" - value: "tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh" + value: "tools/internal_ci/linux/grpc_xds_bazel_test_in_docker.sh" +} +action { + define_artifacts { + regex: "**/*sponge_log.*" + regex: "github/grpc/reports/**" + } } From 63fb190f4460d45d1562f63863705f2bfde57c1a Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Wed, 1 Apr 2020 12:26:50 -0700 Subject: [PATCH 4/4] Revert "to revert: run on kokoro" This reverts commit 936ab4da4f134c2133374d23ff263324c2943796. --- tools/internal_ci/linux/grpc_python_bazel_test.cfg | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tools/internal_ci/linux/grpc_python_bazel_test.cfg b/tools/internal_ci/linux/grpc_python_bazel_test.cfg index 107404a30e9..feae924330e 100644 --- a/tools/internal_ci/linux/grpc_python_bazel_test.cfg +++ b/tools/internal_ci/linux/grpc_python_bazel_test.cfg @@ -1,4 +1,4 @@ -# Copyright 2020 gRPC authors. +# Copyright 2018 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,15 +15,9 @@ # Config file for the internal CI (in protobuf text format) # Location of the continuous shell script in repository. -build_file: "grpc/tools/internal_ci/linux/grpc_xds.sh" -timeout_mins: 90 +build_file: "grpc/tools/internal_ci/linux/grpc_bazel.sh" +timeout_mins: 240 env_vars { key: "BAZEL_SCRIPT" - value: "tools/internal_ci/linux/grpc_xds_bazel_test_in_docker.sh" -} -action { - define_artifacts { - regex: "**/*sponge_log.*" - regex: "github/grpc/reports/**" - } + value: "tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh" }