From f5e7d53b351bea88dcb6b06ef95e579dcee886e3 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Wed, 8 Apr 2020 13:07:50 -0700 Subject: [PATCH] [release/5.0.1xx-preview3] Set up TLS 1.2 before calling dotnet-install for tests (#7068) * Set TLS1.2 before running dotnet-install in tests The new powershell process overrides the setting that build.ps1 sets up. * Reduce logging verbosity --- src/core-sdk-tasks/DownloadFile.cs | 4 ++-- test/SdkTests/SdkTests.csproj | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/core-sdk-tasks/DownloadFile.cs b/src/core-sdk-tasks/DownloadFile.cs index 40178d1eb..382d5cffb 100644 --- a/src/core-sdk-tasks/DownloadFile.cs +++ b/src/core-sdk-tasks/DownloadFile.cs @@ -97,7 +97,7 @@ namespace Microsoft.DotNet.Cli.Build { var httpResponse = await httpClient.GetAsync(source); - Log.LogMessage(MessageImportance.High, $"{source} -> {httpResponse.StatusCode}"); + Log.LogMessage(MessageImportance.Normal, $"{source} -> {httpResponse.StatusCode}"); // The Azure Storage REST API returns '400 - Bad Request' in some cases // where the resource is not found on the storage. @@ -116,7 +116,7 @@ namespace Microsoft.DotNet.Cli.Build await httpResponse.Content.CopyToAsync(outStream); } - Log.LogMessage(MessageImportance.High, $"returning true {source} -> {httpResponse.StatusCode}"); + Log.LogMessage(MessageImportance.Normal, $"returning true {source} -> {httpResponse.StatusCode}"); return true; } catch (Exception e) diff --git a/test/SdkTests/SdkTests.csproj b/test/SdkTests/SdkTests.csproj index ac9e2b663..9e383d60d 100644 --- a/test/SdkTests/SdkTests.csproj +++ b/test/SdkTests/SdkTests.csproj @@ -120,16 +120,20 @@ $(DotnetToTestPath)shared\Microsoft.NETCore.App\$(RuntimeVersionToInstall) - powershell -NoLogo -NoProfile -ExecutionPolicy ByPass - $(InstallRuntimeCommand) "$(_DotNetRoot)dotnet-install.ps1" + + powershell -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& { + $(InstallRuntimeCommand) [Net.ServicePointManager]::SecurityProtocol = 'Tls12, Tls13'; + $(InstallRuntimeCommand) & '$(DotNetRoot)dotnet-install.ps1' $(InstallRuntimeCommand) -Version $(RuntimeVersionToInstall) $(InstallRuntimeCommand) -InstallDir $(DotnetToTestPath) - $(InstallRuntimeCommand) -Runtime "dotnet" - $(InstallRuntimeCommand) -Architecture "$(Architecture)" + $(InstallRuntimeCommand) -Runtime 'dotnet' + $(InstallRuntimeCommand) -Architecture '$(Architecture)' + $(InstallRuntimeCommand) }" /bin/bash - $(InstallRuntimeCommand) "$(_DotNetRoot)dotnet-install.sh" + $(InstallRuntimeCommand) "$(DotNetRoot)dotnet-install.sh" $(InstallRuntimeCommand) --version $(RuntimeVersionToInstall) $(InstallRuntimeCommand) --install-dir "$(DotnetToTestPath)" $(InstallRuntimeCommand) --runtime "dotnet"