diff --git a/tools/internal_ci/helper_scripts/install_python38.ps1 b/tools/internal_ci/helper_scripts/install_python38.ps1 index 251eda0d76c..1c17dba3d66 100644 --- a/tools/internal_ci/helper_scripts/install_python38.ps1 +++ b/tools/internal_ci/helper_scripts/install_python38.ps1 @@ -4,6 +4,12 @@ Set-StrictMode -Version 2 $ErrorActionPreference = 'Stop' +trap { + $ErrorActionPreference = "Continue" + Write-Error $_ + exit 1 +} + # Avoid "Could not create SSL/TLS secure channel" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 @@ -19,7 +25,7 @@ function Install-Python { # Downloads installer Write-Host "Downloading the Python installer: $PythonInstallerUrl => $PythonInstallerPath" - Invoke-WebRequest -Uri $PythonInstallerUrl -OutFile $PythonInstallerPath + Invoke-WebRequest -Uri $PythonInstallerUrl -OutFile $PythonInstallerPath -MaximumRetryCount 3 # Validates checksum $HashFromDownload = Get-FileHash -Path $PythonInstallerPath -Algorithm MD5 diff --git a/tools/internal_ci/helper_scripts/prepare_build_windows.bat b/tools/internal_ci/helper_scripts/prepare_build_windows.bat index 6b39d85ee1d..cda034adc91 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_windows.bat +++ b/tools/internal_ci/helper_scripts/prepare_build_windows.bat @@ -29,20 +29,23 @@ netsh interface ip add dnsservers "Local Area Connection 8" 8.8.8.8 index=2 netsh interface ip add dnsservers "Local Area Connection 8" 8.8.4.4 index=3 @rem Needed for big_query_utils -python -m pip install google-api-python-client +python -m pip install google-api-python-client || goto :error @rem C# prerequisites: Install dotnet SDK -powershell -File src\csharp\install_dotnet_sdk.ps1 +powershell -File src\csharp\install_dotnet_sdk.ps1 || goto :error set PATH=%LOCALAPPDATA%\Microsoft\dotnet;%PATH% @rem Install Python 3.8.0 @rem NOTE(lidiz): Python installer process may live longer than expected, and @rem has other side effects. It needs to be installed last to reduce impact. -powershell -File tools\internal_ci\helper_scripts\install_python38.ps1 +powershell -File tools\internal_ci\helper_scripts\install_python38.ps1 || goto :error @rem Disable some unwanted dotnet options set NUGET_XMLDOC_MODE=skip set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true set DOTNET_CLI_TELEMETRY_OPTOUT=true -git submodule update --init +git submodule update --init || goto :error + +:error +exit /b 1 diff --git a/tools/internal_ci/windows/grpc_build_artifacts.bat b/tools/internal_ci/windows/grpc_build_artifacts.bat index be47fe670b6..473b6ee9822 100644 --- a/tools/internal_ci/windows/grpc_build_artifacts.bat +++ b/tools/internal_ci/windows/grpc_build_artifacts.bat @@ -19,7 +19,7 @@ choco install nasm -y --limit-output @rem enter repo root cd /d %~dp0\..\..\.. -call tools/internal_ci/helper_scripts/prepare_build_windows.bat +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% diff --git a/tools/internal_ci/windows/grpc_build_packages.bat b/tools/internal_ci/windows/grpc_build_packages.bat index 19a805adfc2..a5bffb28c24 100644 --- a/tools/internal_ci/windows/grpc_build_packages.bat +++ b/tools/internal_ci/windows/grpc_build_packages.bat @@ -15,7 +15,7 @@ @rem enter repo root cd /d %~dp0\..\..\.. -call tools/internal_ci/helper_scripts/prepare_build_windows.bat +call tools/internal_ci/helper_scripts/prepare_build_windows.bat || exit /b 1 @rem Move artifacts generated by the previous step in the build chain. powershell -Command "mv %KOKORO_GFILE_DIR%\github\grpc\artifacts input_artifacts" diff --git a/tools/internal_ci/windows/grpc_distribtests.bat b/tools/internal_ci/windows/grpc_distribtests.bat index 72d7076ec90..6b74972f359 100644 --- a/tools/internal_ci/windows/grpc_distribtests.bat +++ b/tools/internal_ci/windows/grpc_distribtests.bat @@ -15,7 +15,7 @@ @rem enter repo root cd /d %~dp0\..\..\.. -call tools/internal_ci/helper_scripts/prepare_build_windows.bat +call tools/internal_ci/helper_scripts/prepare_build_windows.bat || exit /b 1 @rem Move packages generated by the previous step in the build chain. powershell -Command "mv %KOKORO_GFILE_DIR%\github\grpc\artifacts input_artifacts" diff --git a/tools/internal_ci/windows/grpc_distribtests_standalone.bat b/tools/internal_ci/windows/grpc_distribtests_standalone.bat index 80334674144..e0722dbf375 100644 --- a/tools/internal_ci/windows/grpc_distribtests_standalone.bat +++ b/tools/internal_ci/windows/grpc_distribtests_standalone.bat @@ -15,7 +15,7 @@ @rem enter repo root cd /d %~dp0\..\..\.. -call tools/internal_ci/helper_scripts/prepare_build_windows.bat +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% diff --git a/tools/internal_ci/windows/grpc_run_tests_matrix.bat b/tools/internal_ci/windows/grpc_run_tests_matrix.bat index c6277d0929e..01d1f811034 100644 --- a/tools/internal_ci/windows/grpc_run_tests_matrix.bat +++ b/tools/internal_ci/windows/grpc_run_tests_matrix.bat @@ -15,7 +15,7 @@ @rem enter repo root cd /d %~dp0\..\..\.. -call tools/internal_ci/helper_scripts/prepare_build_windows.bat +call tools/internal_ci/helper_scripts/prepare_build_windows.bat || exit /b 1 python tools/run_tests/run_tests_matrix.py %RUN_TESTS_FLAGS% set RUNTESTS_EXITCODE=%errorlevel%