diff --git a/eng/helix/content/InstallDotNet.ps1 b/eng/helix/content/InstallDotNet.ps1 index 7e8786643355..080a14bd7d51 100644 --- a/eng/helix/content/InstallDotNet.ps1 +++ b/eng/helix/content/InstallDotNet.ps1 @@ -1,12 +1,10 @@ <# .SYNOPSIS - Installs dotnet sdk and runtime using https://dot.net/v1/dotnet-install.ps1 + Installs dotnet runtime using https://dot.net/v1/dotnet-install.ps1 .DESCRIPTION - Installs dotnet sdk and runtime using https://dot.net/v1/dotnet-install.ps1 + Installs dotnet runtime using https://dot.net/v1/dotnet-install.ps1 .PARAMETER arch The architecture to install. -.PARAMETER sdkVersion - The sdk version to install .PARAMETER runtimeVersion The runtime version to install .PARAMETER installDir @@ -16,9 +14,6 @@ param( [Parameter(Mandatory = $true)] $arch, - [Parameter(Mandatory = $true)] - $sdkVersion, - [Parameter(Mandatory = $true)] $runtimeVersion, @@ -28,8 +23,6 @@ param( & $PSScriptRoot\Download.ps1 "https://dot.net/v1/dotnet-install.ps1" $PSScriptRoot\dotnet-install.ps1 Write-Host "Download of dotnet-install.ps1 complete..." -Write-Host "Installing SDK...& $PSScriptRoot\dotnet-install.ps1 -Architecture $arch -Version $sdkVersion -InstallDir $installDir" -Invoke-Expression "& $PSScriptRoot\dotnet-install.ps1 -Architecture $arch -Version $sdkVersion -InstallDir $installDir" Write-Host "Installing Runtime...& $PSScriptRoot\dotnet-install.ps1 -Architecture $arch -Runtime dotnet -Version $runtimeVersion -InstallDir $installDir" Invoke-Expression "& $PSScriptRoot\dotnet-install.ps1 -Architecture $arch -Runtime dotnet -Version $runtimeVersion -InstallDir $installDir" -Write-Host "InstallDotNet.ps1 complete..." \ No newline at end of file +Write-Host "InstallDotNet.ps1 complete..." diff --git a/eng/helix/content/RunTests/RunTestsOptions.cs b/eng/helix/content/RunTests/RunTestsOptions.cs index 9e076c970137..e62adef6d501 100644 --- a/eng/helix/content/RunTests/RunTestsOptions.cs +++ b/eng/helix/content/RunTests/RunTestsOptions.cs @@ -21,11 +21,6 @@ public static RunTestsOptions Parse(string[] args) description: "The test dll to run") { Argument = new Argument(), Required = true }, - new Option( - aliases: new string[] { "--sdk" }, - description: "The version of the sdk being used") - { Argument = new Argument(), Required = true }, - new Option( aliases: new string[] { "--runtime" }, description: "The version of the runtime being used") @@ -70,7 +65,6 @@ public static RunTestsOptions Parse(string[] args) var parseResult = command.Parse(args); var options = new RunTestsOptions(); options.Target = parseResult.ValueForOption("--target"); - options.SdkVersion = parseResult.ValueForOption("--sdk"); options.RuntimeVersion = parseResult.ValueForOption("--runtime"); options.HelixQueue = parseResult.ValueForOption("--queue"); options.Architecture = parseResult.ValueForOption("--arch"); @@ -86,7 +80,6 @@ public static RunTestsOptions Parse(string[] args) } public string Target { get; set;} - public string SdkVersion { get; set;} public string RuntimeVersion { get; set;} public string AspNetRuntime { get; set;} public string AspNetRef { get; set;} diff --git a/eng/helix/content/runtests.cmd b/eng/helix/content/runtests.cmd index c1b27b1c890c..4b3c4dfea6d6 100644 --- a/eng/helix/content/runtests.cmd +++ b/eng/helix/content/runtests.cmd @@ -4,35 +4,36 @@ setlocal enabledelayedexpansion REM Use '$' as a variable name prefix to avoid MSBuild variable collisions with these variables set $target=%1 -set $sdkVersion=%2 -set $runtimeVersion=%3 -set $queue=%4 -set $arch=%5 -set $quarantined=%6 -set $ef=%7 -set $aspnetruntime=%8 -set $aspnetref=%9 -REM Batch only supports up to 9 arguments using the %# syntax, need to shift to get more -shift +set $runtimeVersion=%2 +set $queue=%3 +set $arch=%4 +set $quarantined=%5 +set $ef=%6 +set $aspnetruntime=%7 +set $aspnetref=%8 set $helixTimeout=%9 +REM Batch only supports up to 9 arguments using the %# syntax, need to shift to get more -set DOTNET_HOME=%HELIX_CORRELATION_PAYLOAD%\sdk -set DOTNET_ROOT=%DOTNET_HOME%\%$arch% +set DOTNET_ROOT=%HELIX_CORRELATION_PAYLOAD%\dotnet +set DOTNET_HOME=%DOTNET_ROOT% set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 set DOTNET_MULTILEVEL_LOOKUP=0 set DOTNET_CLI_HOME=%HELIX_CORRELATION_PAYLOAD%\home set PATH=%DOTNET_ROOT%;!PATH!;%HELIX_CORRELATION_PAYLOAD%\node\bin echo Set path to: %PATH% -echo "Invoking InstallDotNet.ps1 %$arch% %$sdkVersion% %$runtimeVersion% %DOTNET_ROOT%" -powershell.exe -NoProfile -ExecutionPolicy unrestricted -file InstallDotNet.ps1 %$arch% %$sdkVersion% %$runtimeVersion% %DOTNET_ROOT% +echo "Invoking InstallDotNet.ps1 %$arch% %$runtimeVersion% %DOTNET_ROOT%" +powershell.exe -NoProfile -ExecutionPolicy unrestricted -file InstallDotNet.ps1 %$arch% %$runtimeVersion% %DOTNET_ROOT% + +dotnet --list-sdks +dotnet --list-runtimes set exit_code=0 echo "Restore: dotnet restore RunTests\RunTests.csproj --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --ignore-failed-sources..." dotnet restore RunTests\RunTests.csproj --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --ignore-failed-sources -echo "Running tests: dotnet run --project RunTests\RunTests.csproj -- --target %$target% --sdk %$sdkVersion% --runtime %$runtimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%..." -dotnet run --project RunTests\RunTests.csproj -- --target %$target% --sdk %$sdkVersion% --runtime %$runtimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout% +echo "Running tests: dotnet run --project RunTests\RunTests.csproj -- --target %$target% --runtime %$runtimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%..." +dotnet run --project RunTests\RunTests.csproj -- --target %$target% --runtime %$runtimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout% if errorlevel neq 0 ( set exit_code=%errorlevel% ) diff --git a/eng/helix/content/runtests.sh b/eng/helix/content/runtests.sh index a1bf93270604..583514535f1a 100644 --- a/eng/helix/content/runtests.sh +++ b/eng/helix/content/runtests.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash -dotnet_sdk_version="$2" -dotnet_runtime_version="$3" +dotnet_runtime_version="$2" RESET="\033[0m" RED="\033[0;31m" @@ -11,7 +10,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Ensures every invocation of dotnet apps uses the same dotnet.exe # Add $random to path to ensure tests don't expect dotnet to be in a particular path -export DOTNET_ROOT="$DIR/.dotnet$RANDOM" +export DOTNET_ROOT="$HELIX_CORRELATION_PAYLOAD/dotnet" # Ensure dotnet comes first on PATH export PATH="$DOTNET_ROOT:$PATH:$DIR/node/bin" @@ -47,20 +46,6 @@ fi # Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs) chmod +x "dotnet-install.sh"; sync -./dotnet-install.sh --version $dotnet_sdk_version --install-dir "$DOTNET_ROOT" -if [ $? -ne 0 ]; then - sdk_retries=3 - while [ $sdk_retries -gt 0 ]; do - ./dotnet-install.sh --version $dotnet_sdk_version --install-dir "$DOTNET_ROOT" - if [ $? -ne 0 ]; then - let sdk_retries=sdk_retries-1 - echo -e "${YELLOW}Failed to install .NET Core SDK $version. Retries left: $sdk_retries.${RESET}" - else - sdk_retries=0 - fi - done -fi - ./dotnet-install.sh --runtime dotnet --version $dotnet_runtime_version --install-dir "$DOTNET_ROOT" if [ $? -ne 0 ]; then runtime_retries=3 @@ -85,11 +70,14 @@ fi # dontet-install.sh seems to affect the Linux filesystem and causes test flakiness unless we sync the filesystem before running tests sync +$DOTNET_ROOT/dotnet --list-sdks +$DOTNET_ROOT/dotnet --list-runtimes + exit_code=0 echo "Restore: $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --source https://api.nuget.org/v3/index.json --ignore-failed-sources..." $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --source https://api.nuget.org/v3/index.json --ignore-failed-sources -echo "Running tests: $DOTNET_ROOT/dotnet run --project RunTests/RunTests.csproj -- --target $1 --sdk $2 --runtime $3 --queue $4 --arch $5 --quarantined $6 --ef $7 --aspnetruntime $8 --aspnetref $9 --helixTimeout ${10}..." -$DOTNET_ROOT/dotnet run --project RunTests/RunTests.csproj -- --target $1 --sdk $2 --runtime $3 --queue $4 --arch $5 --quarantined $6 --ef $7 --aspnetruntime $8 --aspnetref $9 --helixTimeout ${10} +echo "Running tests: $DOTNET_ROOT/dotnet run --project RunTests/RunTests.csproj -- --target $1 --runtime $2 --queue $3 --arch $4 --quarantined $5 --ef $6 --aspnetruntime $7 --aspnetref $8 --helixTimeout $9..." +$DOTNET_ROOT/dotnet run --project RunTests/RunTests.csproj -- --target $1 --runtime $2 --queue $3 --arch $4 --quarantined $5 --ef $6 --aspnetruntime $7 --aspnetref $8 --helixTimeout $9 exit_code=$? echo "Finished tests...exit_code=$exit_code" diff --git a/eng/helix/helix.proj b/eng/helix/helix.proj index 250b2fb9b2c8..3a179a8866b7 100644 --- a/eng/helix/helix.proj +++ b/eng/helix/helix.proj @@ -1,5 +1,4 @@ - bin\ $(BaseOutputPath)$(Configuration)\ diff --git a/eng/targets/Helix.targets b/eng/targets/Helix.targets index 0743963a02a9..ad7b35da23b8 100644 --- a/eng/targets/Helix.targets +++ b/eng/targets/Helix.targets @@ -117,8 +117,8 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj $(TargetFileName) @(HelixPreCommand) @(HelixPostCommand) - call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) Microsoft.AspNetCore.App.Runtime.win-x64.$(AppRuntimeVersion).nupkg Microsoft.AspNetCore.App.Ref.$(AppRuntimeVersion).nupkg $(HelixTimeout) - ./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) Microsoft.AspNetCore.App.Runtime.win-x64.$(AppRuntimeVersion).nupkg Microsoft.AspNetCore.App.Ref.$(AppRuntimeVersion).nupkg $(HelixTimeout) + call runtests.cmd $(TargetFileName) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) Microsoft.AspNetCore.App.Runtime.win-x64.$(AppRuntimeVersion).nupkg Microsoft.AspNetCore.App.Ref.$(AppRuntimeVersion).nupkg $(HelixTimeout) + ./runtests.sh $(TargetFileName) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) Microsoft.AspNetCore.App.Runtime.win-x64.$(AppRuntimeVersion).nupkg Microsoft.AspNetCore.App.Ref.$(AppRuntimeVersion).nupkg $(HelixTimeout) $(HelixCommand) $(HelixTimeout)