Allow CI to use a forked test-infra repo.
diff --git a/tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh b/tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh
index 1c19562..c8ec438 100755
--- a/tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh
+++ b/tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh
@@ -18,6 +18,9 @@
cd "$(dirname "$0")/../../.."
source tools/internal_ci/helper_scripts/prepare_build_linux_rc
+if [ -e tools/run_tests/performance/grpc_e2e_performance_gke_experiment.sh ]; then
+ source tools/run_tests/performance/grpc_e2e_performance_gke_experiment.sh
+fi
# This is to ensure we can push and pull images from gcr.io. We do not
# necessarily need it to run load tests, but will need it when we employ
@@ -50,9 +53,17 @@
else
GRPC_CORE_GITREF="$(git ls-remote -h https://github.com/grpc/grpc.git master | cut -f1)"
fi
-GRPC_DOTNET_GITREF="$(git ls-remote -h https://github.com/grpc/grpc-dotnet.git master | cut -f1)"
-GRPC_GO_GITREF="$(git ls-remote -h https://github.com/grpc/grpc-go.git master | cut -f1)"
-GRPC_JAVA_GITREF="$(git ls-remote -h https://github.com/grpc/grpc-java.git master | cut -f1)"
+
+GRPC_DOTNET_REPO="${GRPC_DOTNET_REPO:-grpc/grpc-dotnet}"
+GRPC_GO_REPO="${GRPC_GO_REPO:-grpc/grpc-go}"
+GRPC_JAVA_REPO="${GRPC_JAVA_REPO:-grpc/grpc-java}"
+GRPC_DOTNET_BRANCH="${GRPC_DOTNET_BRANCH:-master}"
+GRPC_GO_REPO_BRANCH="${GRPC_GO_REPO_BRANCH:-master}"
+GRPC_JAVA_REPO_BRANCH="${GRPC_JAVA_REPO_BRANCH:-master}"
+
+GRPC_DOTNET_GITREF="$(git ls-remote https://github.com/"${GRPC_DOTNET_REPO}".git "${GRPC_DOTNET_BRANCH}" | cut -f1)"
+GRPC_GO_GITREF="$(git ls-remote https://github.com/grpc/"${GRPC_GO_REPO}".git "${GRPC_GO_REPO_BRANCH}" | cut -f1)"
+GRPC_JAVA_GITREF="$(git ls-remote https://github.com/grpc/"${GRPC_JAVA_REPO}".git "${GRPC_JAVA_REPO_BRANCH}" | cut -f1)"
# Kokoro jobs run on dedicated pools.
DRIVER_POOL=drivers-ci
WORKER_POOL_8CORE=workers-c2-8core-ci
@@ -61,12 +72,15 @@
# Prefix for log URLs in cnsviewer.
LOG_URL_PREFIX="http://cnsviewer/placer/prod/home/kokoro-dedicated/build_artifacts/${KOKORO_BUILD_ARTIFACTS_SUBDIR}/github/grpc/"
+# The grpc test-infra repo to clone the test-infra repo from
+GRPC_TEST_INFRA_REPO="${GRPC_TEST_INFRA_REPO:-grpc/test-infra}"
+GRPC_TEST_INFRA_BRANCH="${GRPC_TEST_INFRA_BRANCH:-master}"
# Clone test-infra repository and build all tools.
pushd ..
-git clone https://github.com/grpc/test-infra.git
-cd test-infra
+mkdir test-infra && cd test-infra
+git clone https://github.com/"${GRPC_TEST_INFRA_REPO}".git .
# Tools are built from HEAD.
-git checkout --detach
+git checkout "${GRPC_TEST_INFRA_BRANCH}"--detach
make all-tools
popd
diff --git a/tools/run_tests/performance/loadtest_fork.py b/tools/run_tests/performance/loadtest_fork.py
new file mode 100755
index 0000000..6db3c89
--- /dev/null
+++ b/tools/run_tests/performance/loadtest_fork.py
@@ -0,0 +1,98 @@
+#!/usr/bin/env python3
+# Copyright 2023 The gRPC Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Script to generate a shell script containing ENVs necessary to run
+# adhoc/ephemeral jobs with forked test-infra repo other than the
+# grpc/test-infra for the OSS benchmarks
+# tests. The generated script will have name as grpc_e2e_performance_gke_env.sh,
+# and will be sourced in
+# tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh
+#
+# See documentation below:
+
+import argparse
+
+def main() -> None:
+ argp = argparse.ArgumentParser(
+ description='Creates a grpc_e2e_performance_gke_env.sh script providing the necessary ENVs to run OSS performance benchmark tests from some forked repos.')
+ argp.add_argument(
+ '--grpc_test_infra_repo',
+ default='grpc/test-infra',
+ type=str,
+ help='The flag will supply the value for GRPC_TEST_INFRA_REPO environment variables which would be included in tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh, specify the source code of test-infra repo to clone from, default to grpc/test-infra.',
+ )
+ argp.add_argument(
+ '--grpc_test_infra_branch',
+ default='master',
+ type=str,
+ help='The flag will supply the value for GRPC_TEST_INFRA_BRANCH environment variables which would be included in tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh, specify the branch of grpc test-infra repo to check out, default to master.',
+ )
+ argp.add_argument(
+ '--grpc_dotnet_repo',
+ default='grpc/test-infra',
+ type=str,
+ help='The flag will supply the value for GRPC_DOTNET_REPO environment variables which would be included in tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh, specify the source code of grpc dotnet repo to clone from, default to grpc/grpc-dotnet.',
+ )
+ argp.add_argument(
+ '--grpc_dotnet_branch',
+ default='grpc/test-infra',
+ type=str,
+ help='The flag will supply the value for GRPC_DOTNET_BRANCH environment variables which would be included in tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh, specify the branch of grpc dotnet repo to check out, default to master.',
+ )
+ argp.add_argument(
+ '--grpc_java_repo',
+ default='grpc/test-infra',
+ type=str,
+ help='The flag will supply the value for GRPC_JAVA_REPO environment variables which would be included in tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh, specify the source code of grpc java repo to clone from, default to grpc/grpc-java.',
+ )
+ argp.add_argument(
+ '--grpc_java_branch',
+ default='grpc/test-infra',
+ type=str,
+ help='The flag will supply the value for GRPC_JAVA_BRANCH environment variables which would be included in tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh, specify the branch of grpc java repo to check out, default to master.',
+ )
+ argp.add_argument(
+ '--grpc_go_repo',
+ default='grpc/test-infra',
+ type=str,
+ help='The flag will supply the value for GRPC_GO_REPO environment variables which would be included in tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh, specify the source code of grpc java repo to clone from, default to grpc/grpc-go.',
+ )
+ argp.add_argument(
+ '--grpc_go_branch',
+ default='grpc/test-infra',
+ type=str,
+ help='The flag will supply the value for GRPC_GO_BRANCH environment variables which would be included in tools/internal_ci/linux/grpc_e2e_performance_gke_experiment.sh, specify the branch of grpc go repo to check out, default to master.',
+ )
+
+ args = argp.parse_args()
+
+ env_dict = {}
+ env_dict ["GRPC_TEST_INFRA_REPO"] = args.grpc_test_infra_repo
+ env_dict ["GRPC_TEST_INFRA_BRANCH"] = args.grpc_test_infra_branch
+ env_dict ["GRPC_DOTNET_REPO"] = args.grpc_dotnet_repo
+ env_dict ["GRPC_DOTNET_INFRA_BRANCH"] = args.grpc_dotnet_branch
+ env_dict ["GRPC_JAVA_REPO"] = args.grpc_java_repo
+ env_dict ["GRPC_JAVA_BRANCH"] = args.grpc_java_branch
+ env_dict ["GRPC_GO_REPO"] = args.grpc_go_repo
+ env_dict ["GRPC_GO_BRANCH"] = args.grpc_go_branch
+
+
+ with open("grpc_e2e_performance_gke_env.sh", 'w') as export_file:
+ export_file.write("#!/bin/bash\n")
+ for k, v in env_dict.items():
+ export_file.write("{}={}\n".format(k, v))
+
+if __name__ == '__main__':
+ main()