From a7e3e76aed60244db57975ef2ee1e2209f47e8b3 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 16 Apr 2019 09:04:07 -0400 Subject: [PATCH] use different service_account_key for interop tests --- .../helper_scripts/prepare_build_interop_rc | 5 ++--- tools/internal_ci/linux/grpc_interop_toprod.cfg | 9 +++++++++ .../linux/pull_request/grpc_interop_toprod.cfg | 9 +++++++++ tools/internal_ci/macos/grpc_interop_toprod.cfg | 10 +++++++++- tools/internal_ci/macos/grpc_interop_toprod.sh | 2 +- tools/run_tests/run_interop_tests.py | 3 ++- 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/tools/internal_ci/helper_scripts/prepare_build_interop_rc b/tools/internal_ci/helper_scripts/prepare_build_interop_rc index e462a83e522..03105d9a689 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_interop_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_interop_rc @@ -30,7 +30,6 @@ git clone --recursive https://github.com/grpc/grpc-node ./../grpc-node git clone --recursive https://github.com/grpc/grpc-dart ./../grpc-dart git clone --recursive https://github.com/grpc/grpc-dotnet ./../grpc-dotnet -# Download json file. +# Grab the service account key to run interop tests against prod backends. mkdir ~/service_account -gsutil cp gs://grpc-testing-secrets/interop/service_account/GrpcTesting-726eb1347f15.json ~/service_account -export GOOGLE_APPLICATION_CREDENTIALS=~/service_account/GrpcTesting-726eb1347f15.json +cp "${KOKORO_KEYSTORE_DIR}/73836_interop_to_prod_tests_service_account_key" ~/service_account/grpc-testing-ebe7c1ac7381.json || true diff --git a/tools/internal_ci/linux/grpc_interop_toprod.cfg b/tools/internal_ci/linux/grpc_interop_toprod.cfg index de4db81e6ba..377dff771fe 100644 --- a/tools/internal_ci/linux/grpc_interop_toprod.cfg +++ b/tools/internal_ci/linux/grpc_interop_toprod.cfg @@ -28,3 +28,12 @@ env_vars { key: "RUN_TESTS_FLAGS" value: "-l all --cloud_to_prod --cloud_to_prod_auth --prod_servers default gateway_v4 --use_docker --internal_ci -t -j 8 --bq_result_table interop_results" } + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73836 + keyname: "interop_to_prod_tests_service_account_key" + } + } +} diff --git a/tools/internal_ci/linux/pull_request/grpc_interop_toprod.cfg b/tools/internal_ci/linux/pull_request/grpc_interop_toprod.cfg index 7321effc123..636f979473b 100644 --- a/tools/internal_ci/linux/pull_request/grpc_interop_toprod.cfg +++ b/tools/internal_ci/linux/pull_request/grpc_interop_toprod.cfg @@ -28,3 +28,12 @@ env_vars { key: "RUN_TESTS_FLAGS" value: "-l all --cloud_to_prod --cloud_to_prod_auth --prod_servers default gateway_v4 --use_docker --internal_ci -t -j 12" } + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73836 + keyname: "interop_to_prod_tests_service_account_key" + } + } +} diff --git a/tools/internal_ci/macos/grpc_interop_toprod.cfg b/tools/internal_ci/macos/grpc_interop_toprod.cfg index 2cfc8a2d6de..3c11c749e2f 100644 --- a/tools/internal_ci/macos/grpc_interop_toprod.cfg +++ b/tools/internal_ci/macos/grpc_interop_toprod.cfg @@ -17,7 +17,6 @@ # Location of the continuous shell script in repository. build_file: "grpc/tools/internal_ci/macos/grpc_interop_toprod.sh" gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/GrpcTesting-d0eeee2db331.json" -gfile_resources: "/bigstore/grpc-testing-secrets/interop/service_account/GrpcTesting-726eb1347f15.json" timeout_mins: 240 action { define_artifacts { @@ -25,3 +24,12 @@ action { regex: "github/grpc/reports/**" } } + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73836 + keyname: "interop_to_prod_tests_service_account_key" + } + } +} diff --git a/tools/internal_ci/macos/grpc_interop_toprod.sh b/tools/internal_ci/macos/grpc_interop_toprod.sh index 654da373a26..36e5a2103d9 100755 --- a/tools/internal_ci/macos/grpc_interop_toprod.sh +++ b/tools/internal_ci/macos/grpc_interop_toprod.sh @@ -33,7 +33,7 @@ tools/run_tests/run_interop_tests.py -l c++ \ --cloud_to_prod --cloud_to_prod_auth \ --google_default_creds_use_key_file \ --prod_servers default gateway_v4 \ - --service_account_key_file="${KOKORO_GFILE_DIR}/GrpcTesting-726eb1347f15.json" \ + --service_account_key_file="${KOKORO_KEYSTORE_DIR}/73836_interop_to_prod_tests_service_account_key" \ --skip_compute_engine_creds --internal_ci -t -j 4 || FAILED="true" tools/internal_ci/helper_scripts/delete_nonartifacts.sh || true diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 0845647ecd6..c0f153f0106 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -823,9 +823,10 @@ def auth_options(language, if not service_account_key_file: # this file path only works inside docker - service_account_key_file = '/root/service_account/GrpcTesting-726eb1347f15.json' + service_account_key_file = '/root/service_account/grpc-testing-ebe7c1ac7381.json' oauth_scope_arg = '--oauth_scope=https://www.googleapis.com/auth/xapi.zoo' key_file_arg = '--service_account_key_file=%s' % service_account_key_file + # default compute engine credentials associated with the testing VMs in "grpc-testing" cloud project default_account_arg = '--default_service_account=830293263384-compute@developer.gserviceaccount.com' if test_case in ['jwt_token_creds', 'per_rpc_creds', 'oauth2_auth_token']: