From cc2f5497e86a4c029e2928f315f65a01edc20254 Mon Sep 17 00:00:00 2001 From: Brennan Date: Mon, 30 Mar 2020 15:34:02 -0700 Subject: [PATCH] Avoid modifying global machine state on Helix (#20315) --- eng/helix/content/default.NuGet.config | 6 ++++++ eng/helix/content/runtests.cmd | 10 ++++++++-- eng/helix/content/runtests.sh | 10 ++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 eng/helix/content/default.NuGet.config diff --git a/eng/helix/content/default.NuGet.config b/eng/helix/content/default.NuGet.config new file mode 100644 index 0000000000..ade6630535 --- /dev/null +++ b/eng/helix/content/default.NuGet.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eng/helix/content/runtests.cmd b/eng/helix/content/runtests.cmd index 968ab223f9..18e47240ed 100644 --- a/eng/helix/content/runtests.cmd +++ b/eng/helix/content/runtests.cmd @@ -23,14 +23,20 @@ echo "Installing SDK" powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) -Architecture %$arch% -Version %$sdkVersion% -InstallDir %DOTNET_ROOT%" echo "Installing Runtime" powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) -Architecture %$arch% -Runtime dotnet -Version %$runtimeVersion% -InstallDir %DOTNET_ROOT%" + +REM "Rename default.NuGet.config to NuGet.config if there is not a custom one from the project" +if not EXIST ".\NuGet.config" ( + copy default.NuGet.config NuGet.config +) + echo "Checking for Microsoft.AspNetCore.App" if EXIST ".\Microsoft.AspNetCore.App" ( echo "Found Microsoft.AspNetCore.App, copying to %DOTNET_ROOT%\shared\Microsoft.AspNetCore.App\%runtimeVersion%" xcopy /i /y ".\Microsoft.AspNetCore.App" %DOTNET_ROOT%\shared\Microsoft.AspNetCore.App\%runtimeVersion%\ echo "Adding current directory to nuget sources: %HELIX_WORKITEM_ROOT%" - dotnet nuget add source %HELIX_WORKITEM_ROOT% - dotnet nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json + dotnet nuget add source %HELIX_WORKITEM_ROOT% --configfile NuGet.config + dotnet nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --configfile NuGet.config dotnet nuget list source dotnet tool install dotnet-ef --global --version %$efVersion% diff --git a/eng/helix/content/runtests.sh b/eng/helix/content/runtests.sh index c8c84f1c33..26a9f45339 100755 --- a/eng/helix/content/runtests.sh +++ b/eng/helix/content/runtests.sh @@ -93,6 +93,12 @@ if [ $? -ne 0 ]; then done fi +# Rename default.NuGet.config to NuGet.config if there is not a custom one from the project +if [ ! -f "NuGet.config" ] +then + cp default.NuGet.config NuGet.config +fi + # Copy over any local shared fx if found if [ -d "Microsoft.AspNetCore.App" ] then @@ -100,8 +106,8 @@ then cp -r Microsoft.AspNetCore.App $DOTNET_ROOT/shared/Microsoft.AspNetCore.App/$dotnet_runtime_version echo "Adding current directory to nuget sources: $DIR" - dotnet nuget add source $DIR - dotnet nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json + dotnet nuget add source $DIR --configfile NuGet.config + dotnet nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --configfile NuGet.config dotnet nuget list source dotnet tool install dotnet-ef --global --version $efVersion