Avoid extremely slow kokoro job finalization by moving workspace to a non-synced directory on kokoro workers. (#28259)

* support "move and respawn" for kokoro jobs

* delete_nonartifacts.sh no longer needed

* bazel distribtest dont publish any artifacts

* try the altsrc respawn for selected jobs

* use altsrc for all windows CI jobs

* use altsrc for all macos CI jobs

* only move files under src/github

* fix uploading artifacts on windows
pull/28177/head
Jan Tattermusch 3 years ago committed by GitHub
parent a0c975abd5
commit 3a024ea40c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      tools/internal_ci/helper_scripts/delete_nonartifacts.sh
  2. 58
      tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself.bat
  3. 52
      tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
  4. 37
      tools/internal_ci/helper_scripts/store_artifacts_from_moved_src_tree.sh
  5. 1
      tools/internal_ci/linux/grpc_bazel_distribtest.cfg
  6. 1
      tools/internal_ci/linux/grpc_bazel_distribtest_latest.cfg
  7. 12
      tools/internal_ci/linux/grpc_build_artifacts.sh
  8. 13
      tools/internal_ci/linux/grpc_build_packages.sh
  9. 3
      tools/internal_ci/linux/grpc_distribtests.sh
  10. 5
      tools/internal_ci/linux/grpc_distribtests_php.sh
  11. 5
      tools/internal_ci/linux/grpc_distribtests_python.sh
  12. 5
      tools/internal_ci/linux/grpc_distribtests_ruby.sh
  13. 3
      tools/internal_ci/linux/grpc_distribtests_standalone.sh
  14. 3
      tools/internal_ci/linux/grpc_run_interop_tests.sh
  15. 3
      tools/internal_ci/linux/grpc_run_tests_matrix.sh
  16. 5
      tools/internal_ci/macos/grpc_build_artifacts.sh
  17. 12
      tools/internal_ci/macos/grpc_distribtests.sh
  18. 5
      tools/internal_ci/macos/grpc_distribtests_php.sh
  19. 5
      tools/internal_ci/macos/grpc_interop_toprod.sh
  20. 3
      tools/internal_ci/macos/grpc_ios_binary_size.sh
  21. 3
      tools/internal_ci/macos/grpc_run_bazel_c_cpp_tests.sh
  22. 3
      tools/internal_ci/macos/grpc_run_bazel_core_ios_tests.sh
  23. 3
      tools/internal_ci/macos/grpc_run_bazel_cpp_ios_tests.sh
  24. 3
      tools/internal_ci/macos/grpc_run_bazel_isolated_tests.sh
  25. 5
      tools/internal_ci/macos/grpc_run_tests_matrix.sh
  26. 7
      tools/internal_ci/windows/bazel_rbe.bat
  27. 9
      tools/internal_ci/windows/grpc_build_artifacts.bat
  28. 9
      tools/internal_ci/windows/grpc_build_packages.bat
  29. 9
      tools/internal_ci/windows/grpc_distribtests.bat
  30. 9
      tools/internal_ci/windows/grpc_distribtests_standalone.bat
  31. 9
      tools/internal_ci/windows/grpc_run_tests_matrix.bat
  32. 8
      tools/run_tests/dockerize/build_docker_and_run_tests.sh
  33. 4
      tools/run_tests/python_utils/report_utils.py
  34. 16
      tools/run_tests/run_tests_matrix.py

@ -1,27 +0,0 @@
#!/usr/bin/env bash
# Copyright 2018 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.
set -ex
# change to grpc repo root
cd "$(dirname "$0")/../../.."
# After kokoro build finishes, the workspace gets rsync'ed to another machine,
# from where the artifacts and reports are processed.
# Especially on Windows, the rsync can take long time, so we cleanup the workspace
# after finishing each build. We only leave files we want to keep:
# - reports and artifacts
# - directory containing the kokoro scripts to prevent deleting a script while being executed.
time find . -type f -not -iname "*sponge_log.*" -not -path "./reports/*" -not -path "./artifacts/*" -not -path "./tools/internal_ci/*" -exec rm -f {} +

@ -0,0 +1,58 @@
@rem Copyright 2021 The gRPC Authors
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem Call this script at the beginning of your CI script to move
@rem the entire source tree to a different directory.
@rem That avoids slow finalization (and a number of other problems)
@rem caused by kokoro rsyncing the entire /tmpfs/src directory
@rem back to the agent.
@rem Since batch scripts don't support the "source" unix command,
@rem invoking this script is a bit trickier than on unix.
@rem This script should be invoked from the CI script like this:
@rem IF "%cd%"=="T:\src" (
@rem call %~dp0\..\..\..\tools\internal_ci\helper_scripts\move_src_tree_and_respawn_itself.bat %0
@rem exit /b %errorlevel%
@rem )
@echo off
@rem CI script path needs to be passed as arg1.
set CI_SCRIPT_RELATIVE_TO_SRC=%1
@rem Check that this script was invoked under correct circumstances.
IF NOT "%cd%"=="T:\src" (
@echo "Error: Current directory must be T:\src when invoking move_src_tree_and_respawn_itself.bat"
exit /b 1
)
@rem T:\ is equivalent to /tmpfs on kokoro linux.
echo "Moving workspace from T:\src to T:\altsrc and respawning the CI script."
cd /d T:\
@rem We cannot simply rename "src" to "altsrc" as on linux since the currently running batch file is in it
@rem and windows holds a lock that prevents moving the dir.
bash -c "set -ex; mkdir -p altsrc; time cp -r src/github altsrc;"
@rem Delete files we can under the original "src/github" directory, skipping the directory that contains CI scripts
@rem (as on of the scripts is currently running and cannot be deleted)
@rem We don't want to delete files in "src" outside of "src/github" since they contain e.g kokoro input artifacts.
bash -c "set -ex; cd src/github; time find . -type f -not -path './grpc/tools/internal_ci/*' -exec rm -f {} +; ls grpc"
cd altsrc
@rem scripts in tools/run_tests generate test reports and we need to make sure these reports
@rem land in a directory that is going to be rsynced back to the kokoro agent.
set GRPC_TEST_REPORT_BASE_DIR=T:\src\github\grpc
echo "Invoking original CI script now."
@echo on
call "%CI_SCRIPT_RELATIVE_TO_SRC%"
exit /b %errorlevel%

@ -0,0 +1,52 @@
#!/bin/bash
# Copyright 2021 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.
# Source this rc script at the beginning of your CI script to move
# the entire source tree to a different directory.
# That avoids slow finalization (and a number of other problems)
# caused by kokoro rsyncing the entire /tmpfs/src directory
# back to the agent.
# See b/74837748 for more context.
set -ex
CURRENT_DIR="$(pwd)"
CI_SCRIPT_RELATIVE_TO_SRC="$0"
if [ "${CURRENT_DIR}" == "/tmpfs/altsrc" ]
then
# we already respawned under /tmpfs/altsrc, no need to do anything
echo "Successfully respawned the CI script ${CI_SCRIPT_RELATIVE_TO_SRC} under ${CURRENT_DIR}."
# scripts in tools/run_tests generate test reports and we need to make sure these reports
# land in a directory that is going to be rsynced back to the kokoro agent.
export GRPC_TEST_REPORT_BASE_DIR="/tmpfs/src/github/grpc"
elif [ "${CURRENT_DIR}" == "/tmpfs/src" ]
then
# we need to respawn now
# - step out of current directory
# - rename src/github to altsrc/github (/tmpfs/src is the directory that gets rsynced back to kokoro agent once the CI script finishes).
# Note that we don't want to move the entire /tmpfs/src tree (which contains e.g. the input artifacts as well,
# and their path is referenced by kokoro env variables), just /tmpfs/src/github
# which contains all the cloned github repositories (=our workspace in which the build happens)
echo "Moving workspace from /tmpfs/src to /tmpfs/altsrc and respawning the CI script."
# once "exec bash" starts, the CI script in the original location will no longer be in use and it will be safe to move
# the entire "/tmpfs/src/github" tree (moving the bash script file while running is probably safe anyway on unix, but it doesn't
# hurt to be extra careful)
exec bash -c "set -ex; cd /tmpfs; mkdir -p altsrc; mv src/github altsrc; cd altsrc; exec '${CI_SCRIPT_RELATIVE_TO_SRC}'"
else
# avoid messing with the workspace if we don't see the directory layout
# that's standard on kokoro (in case this script gets accidentally invoked outside of kokoro)
echo "Looks the script is currently not running on kokoro, skipping respawn and continuing the original CI script."
fi

@ -0,0 +1,37 @@
#!/usr/bin/env bash
# Copyright 2021 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.
# If you have used "move_src_tree_and_respawn_itself_rc" in a CI script
# and the script produces artifacts to be stored by kokoro, run this
# at the end of the script.
set -ex
if [ "${GRPC_TEST_REPORT_BASE_DIR}" == "" ]
then
# looks like the move_src_tree_and_respawn_itself_rc hasn't been used
# and we're not running under a moved source tree
exit 0
fi
# change to grpc repo root
cd "$(dirname "$0")/../../.."
# If running under a moved source tree (see grpc/tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc),
# we need to copy the artifacts produced by the build to a location that's stored by kokoro.
# artifacts in this directory will be stored by kokoro
mkdir -p "${GRPC_TEST_REPORT_BASE_DIR}/artifacts"
time cp -r artifacts/* "${GRPC_TEST_REPORT_BASE_DIR}/artifacts" || true

@ -21,6 +21,5 @@ action {
define_artifacts {
regex: "**/*sponge_log.*"
regex: "github/grpc/reports/**"
regex: "github/grpc/artifacts/**"
}
}

@ -21,6 +21,5 @@ action {
define_artifacts {
regex: "**/*sponge_log.*"
regex: "github/grpc/reports/**"
regex: "github/grpc/artifacts/**"
}
}

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..
@ -26,4 +29,11 @@ set -e # rvm commands are very verbose
rvm --default use ruby-2.4.1
set -ex
tools/run_tests/task_runner.py -f artifact linux -j 12
tools/run_tests/task_runner.py -f artifact linux -j 12 || FAILED="true"
tools/internal_ci/helper_scripts/store_artifacts_from_moved_src_tree.sh
if [ "$FAILED" != "" ]
then
exit 1
fi

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..
@ -33,4 +36,12 @@ mv ${KOKORO_GFILE_DIR}/github/grpc/artifacts input_artifacts || true
chmod +x input_artifacts/protoc*/* || true
ls -R input_artifacts || true
tools/run_tests/task_runner.py -f package linux -j 6
tools/run_tests/task_runner.py -f package linux -j 6 || FAILED="true"
tools/internal_ci/helper_scripts/store_artifacts_from_moved_src_tree.sh
if [ "$FAILED" != "" ]
then
exit 1
fi

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..
@ -45,6 +48,8 @@ cp -r artifacts/* input_artifacts/ || true
# a better signal about which distribtest are affected by the currently broken artifact builds.
tools/run_tests/task_runner.py -f distribtest linux php -j 4 -x distribtests/sponge_log.xml || FAILED="true"
tools/internal_ci/helper_scripts/store_artifacts_from_moved_src_tree.sh
if [ "$FAILED" != "" ]
then
exit 1

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..
@ -50,6 +53,8 @@ cp -r artifacts/* input_artifacts/ || true
# a better signal about which distribtest are affected by the currently broken artifact builds.
tools/run_tests/task_runner.py -f distribtest linux python -j 12 -x distribtests/sponge_log.xml || FAILED="true"
tools/internal_ci/helper_scripts/store_artifacts_from_moved_src_tree.sh
if [ "$FAILED" != "" ]
then
exit 1

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..
@ -46,6 +49,8 @@ cp -r artifacts/ruby_native_gem_*/* input_artifacts/ || true
# a better signal about which distribtest are affected by the currently broken artifact builds.
tools/run_tests/task_runner.py -f distribtest linux ruby -j 6 -x distribtests/sponge_log.xml || FAILED="true"
tools/internal_ci/helper_scripts/store_artifacts_from_moved_src_tree.sh
if [ "$FAILED" != "" ]
then
exit 1

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
export LANG=en_US.UTF-8
# Enter the gRPC repo root

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..
@ -40,7 +43,7 @@ update_rubygems
tools/run_tests/task_runner.py -f artifact macos || FAILED="true"
tools/internal_ci/helper_scripts/delete_nonartifacts.sh || true
tools/internal_ci/helper_scripts/store_artifacts_from_moved_src_tree.sh
if [ "$FAILED" != "" ]
then

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..
@ -26,11 +29,4 @@ source tools/internal_ci/helper_scripts/prepare_build_macos_rc
mv ${KOKORO_GFILE_DIR}/github/grpc/artifacts input_artifacts || true
ls -R input_artifacts || true
tools/run_tests/task_runner.py -f distribtest macos || FAILED="true"
tools/internal_ci/helper_scripts/delete_nonartifacts.sh || true
if [ "$FAILED" != "" ]
then
exit 1
fi
tools/run_tests/task_runner.py -f distribtest macos

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..
@ -39,7 +42,7 @@ cp -r artifacts/php_pecl_package_macos_*/* input_artifacts/ || true
# a better signal about which distribtest are affected by the currently broken artifact builds.
tools/run_tests/task_runner.py -f distribtest macos php -j 4 -x distribtests/sponge_log.xml || FAILED="true"
tools/internal_ci/helper_scripts/delete_nonartifacts.sh || true
tools/internal_ci/helper_scripts/store_artifacts_from_moved_src_tree.sh
if [ "$FAILED" != "" ]
then

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..
@ -41,8 +44,6 @@ tools/run_tests/run_interop_tests.py -l c++ \
--default_service_account="interop-to-prod-tests@grpc-testing.iam.gserviceaccount.com" \
--skip_compute_engine_creds --internal_ci -t -j 4 || FAILED="true"
tools/internal_ci/helper_scripts/delete_nonartifacts.sh || true
if [ "$FAILED" != "" ]
then
exit 1

@ -16,6 +16,9 @@
# This script is invoked by Jenkins and runs a diff on the microbenchmarks
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# List of benchmarks that provide good signal for analyzing performance changes in pull requests
# Enter the gRPC repo root

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..

@ -15,6 +15,9 @@
set -ex
# avoid slow finalization after the script has exited.
source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and_respawn_itself_rc
# change to grpc repo root
cd $(dirname $0)/../../..
@ -25,8 +28,6 @@ tools/run_tests/run_tests_matrix.py $RUN_TESTS_FLAGS || FAILED="true"
# kill port_server.py to prevent the build from freezing
ps aux | grep port_server\\.py | awk '{print $2}' | xargs kill -9
tools/internal_ci/helper_scripts/delete_nonartifacts.sh || true
if [ "$FAILED" != "" ]
then
exit 1

@ -12,6 +12,13 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem Avoid slow finalization after the script has exited.
@rem See the script's prologue for info on the correct invocation pattern.
IF "%cd%"=="T:\src" (
call %~dp0\..\..\..\tools\internal_ci\helper_scripts\move_src_tree_and_respawn_itself.bat %0
exit /b %errorlevel%
)
@rem TODO(jtattermusch): make this generate less output
@rem TODO(jtattermusch): use tools/bazel script to keep the versions in sync
choco install bazel -y --version 4.2.1 --limit-output

@ -12,6 +12,13 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem Avoid slow finalization after the script has exited.
@rem See the script's prologue for info on the correct invocation pattern.
IF "%cd%"=="T:\src" (
call %~dp0\..\..\..\tools\internal_ci\helper_scripts\move_src_tree_and_respawn_itself.bat %0
exit /b %errorlevel%
)
@rem Boringssl build no longer supports yasm
choco uninstall yasm -y --limit-output
choco install nasm -y --limit-output
@ -25,6 +32,6 @@ call tools/internal_ci/helper_scripts/prepare_build_windows.bat || exit /b 1
python tools/run_tests/task_runner.py -f artifact windows -j 4
set RUNTESTS_EXITCODE=%errorlevel%
bash tools/internal_ci/helper_scripts/delete_nonartifacts.sh
bash tools/internal_ci/helper_scripts/store_artifacts_from_moved_src_tree.sh
exit /b %RUNTESTS_EXITCODE%

@ -12,6 +12,13 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem Avoid slow finalization after the script has exited.
@rem See the script's prologue for info on the correct invocation pattern.
IF "%cd%"=="T:\src" (
call %~dp0\..\..\..\tools\internal_ci\helper_scripts\move_src_tree_and_respawn_itself.bat %0
exit /b %errorlevel%
)
@rem enter repo root
cd /d %~dp0\..\..\..
@ -24,6 +31,4 @@ rem The only build_packages task that ever needed to run on windows was C#, but
rem building C# nugets on linux (as dotnet SDK on linux does a good job)
rem TODO(jtattermusch): remove the infrastructure for running "build_packages" kokoro job on windows.
bash tools/internal_ci/helper_scripts/delete_nonartifacts.sh
exit /b %RUNTESTS_EXITCODE%

@ -12,6 +12,13 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem Avoid slow finalization after the script has exited.
@rem See the script's prologue for info on the correct invocation pattern.
IF "%cd%"=="T:\src" (
call %~dp0\..\..\..\tools\internal_ci\helper_scripts\move_src_tree_and_respawn_itself.bat %0
exit /b %errorlevel%
)
@rem enter repo root
cd /d %~dp0\..\..\..
@ -24,6 +31,4 @@ dir input_artifacts
python tools/run_tests/task_runner.py -f distribtest windows -j 4
set RUNTESTS_EXITCODE=%errorlevel%
bash tools/internal_ci/helper_scripts/delete_nonartifacts.sh
exit /b %RUNTESTS_EXITCODE%

@ -12,6 +12,13 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem Avoid slow finalization after the script has exited.
@rem See the script's prologue for info on the correct invocation pattern.
IF "%cd%"=="T:\src" (
call %~dp0\..\..\..\tools\internal_ci\helper_scripts\move_src_tree_and_respawn_itself.bat %0
exit /b %errorlevel%
)
@rem enter repo root
cd /d %~dp0\..\..\..
@ -20,6 +27,4 @@ call tools/internal_ci/helper_scripts/prepare_build_windows.bat || exit /b 1
python tools/run_tests/task_runner.py -f distribtest windows cpp -j 4
set RUNTESTS_EXITCODE=%errorlevel%
bash tools/internal_ci/helper_scripts/delete_nonartifacts.sh
exit /b %RUNTESTS_EXITCODE%

@ -12,6 +12,13 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem Avoid slow finalization after the script has exited.
@rem See the script's prologue for info on the correct invocation pattern.
IF "%cd%"=="T:\src" (
call %~dp0\..\..\..\tools\internal_ci\helper_scripts\move_src_tree_and_respawn_itself.bat %0
exit /b %errorlevel%
)
@rem enter repo root
cd /d %~dp0\..\..\..
@ -28,6 +35,4 @@ python3 tools/run_tests/start_port_server.py
python3 tools/run_tests/run_tests_matrix.py %RUN_TESTS_FLAGS%
set RUNTESTS_EXITCODE=%errorlevel%
bash tools/internal_ci/helper_scripts/delete_nonartifacts.sh
exit /b %RUNTESTS_EXITCODE%

@ -81,7 +81,13 @@ docker run \
# run_tests.py runs
TEMP_REPORTS_ZIP=$(mktemp)
docker cp "$CONTAINER_NAME:/var/local/git/grpc/reports.zip" "${TEMP_REPORTS_ZIP}" || true
unzip -o "${TEMP_REPORTS_ZIP}" -d "$git_root" || true
if [ "${GRPC_TEST_REPORT_BASE_DIR}" != "" ]
then
REPORTS_DEST_DIR="${GRPC_TEST_REPORT_BASE_DIR}"
else
REPORTS_DEST_DIR="${git_root}"
fi
unzip -o "${TEMP_REPORTS_ZIP}" -d "${REPORTS_DEST_DIR}" || true
rm -f "${TEMP_REPORTS_ZIP}"
# remove the container, possibly killing it first

@ -80,6 +80,10 @@ def render_junit_xml_report(resultset,
def create_xml_report_file(tree, report_file):
"""Generate JUnit-like report file from xml tree ."""
# env variable can be used to override the base location for the reports
base_dir = os.getenv('GRPC_TEST_REPORT_BASE_DIR', None)
if base_dir:
report_file = os.path.join(base_dir, report_file)
# ensure the report directory exists
report_dir = os.path.dirname(os.path.abspath(report_file))
if not os.path.exists(report_dir):

@ -62,8 +62,14 @@ def _matrix_job_logfilename(shortname_for_multi_target):
# for the corresponding 'sponge_log.xml' report.
# the shortname_for_multi_target component must be set to match the sponge_log.xml location
# because the top-level render_junit_xml_report is called with multi_target=True
return '%s/%s/%s' % (_MATRIX_REPORT_NAME, shortname_for_multi_target,
'sponge_log.log')
sponge_log_name = '%s/%s/%s' % (
_MATRIX_REPORT_NAME, shortname_for_multi_target, 'sponge_log.log')
# env variable can be used to override the base location for the reports
# so we need to match that behavior here too
base_dir = os.getenv('GRPC_TEST_REPORT_BASE_DIR', None)
if base_dir:
sponge_log_name = os.path.join(base_dir, sponge_log_name)
return sponge_log_name
def _docker_jobspec(name,
@ -102,11 +108,15 @@ def _workspace_jobspec(name,
shortname = 'run_tests_%s' % name
env = {'WORKSPACE_NAME': workspace_name}
env.update(runtests_envs)
# if report base dir is set, we don't need to ".." to come out of the workspace dir
report_dir_prefix = '' if os.getenv('GRPC_TEST_REPORT_BASE_DIR',
None) else '../'
test_job = jobset.JobSpec(cmdline=[
'bash', 'tools/run_tests/helper_scripts/run_tests_in_workspace.sh',
'-t', '-j',
str(inner_jobs), '-x',
'../run_tests/%s' % _report_filename(name), '--report_suite_name',
'%srun_tests/%s' %
(report_dir_prefix, _report_filename(name)), '--report_suite_name',
'%s' % _safe_report_name(name)
] + runtests_args,
environ=env,

Loading…
Cancel
Save