Skip to content

Commit d9049ec

Browse files
authored
Revert "Try using helix sdk support directly again (#23585)" (#24250)
This reverts commit 059fe39.
1 parent c27dcc4 commit d9049ec

File tree

6 files changed

+56
-32
lines changed

6 files changed

+56
-32
lines changed

eng/helix/content/InstallDotNet.ps1

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<#
22
.SYNOPSIS
3-
Installs dotnet runtime using https://dot.net/v1/dotnet-install.ps1
3+
Installs dotnet sdk and runtime using https://dot.net/v1/dotnet-install.ps1
44
.DESCRIPTION
5-
Installs dotnet runtime using https://dot.net/v1/dotnet-install.ps1
5+
Installs dotnet sdk and runtime using https://dot.net/v1/dotnet-install.ps1
66
.PARAMETER arch
77
The architecture to install.
8+
.PARAMETER sdkVersion
9+
The sdk version to install
810
.PARAMETER runtimeVersion
911
The runtime version to install
1012
.PARAMETER installDir
@@ -14,6 +16,9 @@ param(
1416
[Parameter(Mandatory = $true)]
1517
$arch,
1618

19+
[Parameter(Mandatory = $true)]
20+
$sdkVersion,
21+
1722
[Parameter(Mandatory = $true)]
1823
$runtimeVersion,
1924

@@ -23,6 +28,8 @@ param(
2328

2429
& $PSScriptRoot\Download.ps1 "https://dot.net/v1/dotnet-install.ps1" $PSScriptRoot\dotnet-install.ps1
2530
Write-Host "Download of dotnet-install.ps1 complete..."
31+
Write-Host "Installing SDK...& $PSScriptRoot\dotnet-install.ps1 -Architecture $arch -Version $sdkVersion -InstallDir $installDir"
32+
Invoke-Expression "& $PSScriptRoot\dotnet-install.ps1 -Architecture $arch -Version $sdkVersion -InstallDir $installDir"
2633
Write-Host "Installing Runtime...& $PSScriptRoot\dotnet-install.ps1 -Architecture $arch -Runtime dotnet -Version $runtimeVersion -InstallDir $installDir"
2734
Invoke-Expression "& $PSScriptRoot\dotnet-install.ps1 -Architecture $arch -Runtime dotnet -Version $runtimeVersion -InstallDir $installDir"
28-
Write-Host "InstallDotNet.ps1 complete..."
35+
Write-Host "InstallDotNet.ps1 complete..."

eng/helix/content/RunTests/RunTestsOptions.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public static RunTestsOptions Parse(string[] args)
2121
description: "The test dll to run")
2222
{ Argument = new Argument<string>(), Required = true },
2323

24+
new Option(
25+
aliases: new string[] { "--sdk" },
26+
description: "The version of the sdk being used")
27+
{ Argument = new Argument<string>(), Required = true },
28+
2429
new Option(
2530
aliases: new string[] { "--runtime" },
2631
description: "The version of the runtime being used")
@@ -65,6 +70,7 @@ public static RunTestsOptions Parse(string[] args)
6570
var parseResult = command.Parse(args);
6671
var options = new RunTestsOptions();
6772
options.Target = parseResult.ValueForOption<string>("--target");
73+
options.SdkVersion = parseResult.ValueForOption<string>("--sdk");
6874
options.RuntimeVersion = parseResult.ValueForOption<string>("--runtime");
6975
options.HelixQueue = parseResult.ValueForOption<string>("--queue");
7076
options.Architecture = parseResult.ValueForOption<string>("--arch");
@@ -80,6 +86,7 @@ public static RunTestsOptions Parse(string[] args)
8086
}
8187

8288
public string Target { get; set;}
89+
public string SdkVersion { get; set;}
8390
public string RuntimeVersion { get; set;}
8491
public string AspNetRuntime { get; set;}
8592
public string AspNetRef { get; set;}

eng/helix/content/runtests.cmd

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,35 @@ setlocal enabledelayedexpansion
44

55
REM Use '$' as a variable name prefix to avoid MSBuild variable collisions with these variables
66
set $target=%1
7-
set $runtimeVersion=%2
8-
set $queue=%3
9-
set $arch=%4
10-
set $quarantined=%5
11-
set $ef=%6
12-
set $aspnetruntime=%7
13-
set $aspnetref=%8
14-
set $helixTimeout=%9
7+
set $sdkVersion=%2
8+
set $runtimeVersion=%3
9+
set $queue=%4
10+
set $arch=%5
11+
set $quarantined=%6
12+
set $ef=%7
13+
set $aspnetruntime=%8
14+
set $aspnetref=%9
1515
REM Batch only supports up to 9 arguments using the %# syntax, need to shift to get more
16+
shift
17+
set $helixTimeout=%9
1618

17-
set DOTNET_ROOT=%HELIX_CORRELATION_PAYLOAD%\dotnet
18-
set DOTNET_HOME=%DOTNET_ROOT%
19+
set DOTNET_HOME=%HELIX_CORRELATION_PAYLOAD%\sdk
20+
set DOTNET_ROOT=%DOTNET_HOME%\%$arch%
1921
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
2022
set DOTNET_MULTILEVEL_LOOKUP=0
2123
set DOTNET_CLI_HOME=%HELIX_CORRELATION_PAYLOAD%\home
2224

2325
set PATH=%DOTNET_ROOT%;!PATH!;%HELIX_CORRELATION_PAYLOAD%\node\bin
2426
echo Set path to: %PATH%
25-
echo "Invoking InstallDotNet.ps1 %$arch% %$runtimeVersion% %DOTNET_ROOT%"
26-
powershell.exe -NoProfile -ExecutionPolicy unrestricted -file InstallDotNet.ps1 %$arch% %$runtimeVersion% %DOTNET_ROOT%
27-
28-
dotnet --list-sdks
29-
dotnet --list-runtimes
27+
echo "Invoking InstallDotNet.ps1 %$arch% %$sdkVersion% %$runtimeVersion% %DOTNET_ROOT%"
28+
powershell.exe -NoProfile -ExecutionPolicy unrestricted -file InstallDotNet.ps1 %$arch% %$sdkVersion% %$runtimeVersion% %DOTNET_ROOT%
3029

3130
set exit_code=0
3231
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..."
3332
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
3433

35-
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%..."
36-
dotnet run --project RunTests\RunTests.csproj -- --target %$target% --runtime %$runtimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%
34+
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%..."
35+
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%
3736
if errorlevel neq 0 (
3837
set exit_code=%errorlevel%
3938
)

eng/helix/content/runtests.sh

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22

3-
dotnet_runtime_version="$2"
3+
dotnet_sdk_version="$2"
4+
dotnet_runtime_version="$3"
45

56
RESET="\033[0m"
67
RED="\033[0;31m"
@@ -10,7 +11,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1011

1112
# Ensures every invocation of dotnet apps uses the same dotnet.exe
1213
# Add $random to path to ensure tests don't expect dotnet to be in a particular path
13-
export DOTNET_ROOT="$HELIX_CORRELATION_PAYLOAD/dotnet"
14+
export DOTNET_ROOT="$DIR/.dotnet$RANDOM"
1415

1516
# Ensure dotnet comes first on PATH
1617
export PATH="$DOTNET_ROOT:$PATH:$DIR/node/bin"
@@ -46,6 +47,20 @@ fi
4647
# Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs)
4748
chmod +x "dotnet-install.sh"; sync
4849

50+
./dotnet-install.sh --version $dotnet_sdk_version --install-dir "$DOTNET_ROOT"
51+
if [ $? -ne 0 ]; then
52+
sdk_retries=3
53+
while [ $sdk_retries -gt 0 ]; do
54+
./dotnet-install.sh --version $dotnet_sdk_version --install-dir "$DOTNET_ROOT"
55+
if [ $? -ne 0 ]; then
56+
let sdk_retries=sdk_retries-1
57+
echo -e "${YELLOW}Failed to install .NET Core SDK $version. Retries left: $sdk_retries.${RESET}"
58+
else
59+
sdk_retries=0
60+
fi
61+
done
62+
fi
63+
4964
./dotnet-install.sh --runtime dotnet --version $dotnet_runtime_version --install-dir "$DOTNET_ROOT"
5065
if [ $? -ne 0 ]; then
5166
runtime_retries=3
@@ -70,14 +85,11 @@ fi
7085
# dontet-install.sh seems to affect the Linux filesystem and causes test flakiness unless we sync the filesystem before running tests
7186
sync
7287

73-
$DOTNET_ROOT/dotnet --list-sdks
74-
$DOTNET_ROOT/dotnet --list-runtimes
75-
7688
exit_code=0
7789
echo "Restore: $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --source https://api.nuget.org/v3/index.json --ignore-failed-sources..."
7890
$DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --source https://api.nuget.org/v3/index.json --ignore-failed-sources
79-
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..."
80-
$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
91+
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}..."
92+
$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}
8193
exit_code=$?
8294
echo "Finished tests...exit_code=$exit_code"
8395

eng/helix/helix.proj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<Project Sdk="Microsoft.DotNet.Helix.Sdk" DefaultTargets="Test" TreatAsLocalProperty="ProjectToBuild">
2+
23
<PropertyGroup>
34
<!--
45
When invoking helix.proj for the whole repo with build.cmd, ProjectToBuild will be set to the path to this project.
@@ -21,9 +22,7 @@
2122
<IsExternal>true</IsExternal>
2223
<MaxRetryCount Condition="'$(MaxRetryCount)' == ''">2</MaxRetryCount>
2324
<HelixAccessToken Condition="'$(_UseHelixOpenQueues)' != 'true'">$(HelixApiAccessToken)</HelixAccessToken>
24-
<IncludeDotNetCli>true</IncludeDotNetCli>
25-
<DotNetCliPackageType>sdk</DotNetCliPackageType>
26-
25+
2726
<!-- Copied from Microsoft.NET.DefaultOutputPaths.targets in the .NET SDK. The Helix SDK contains nothing similar. -->
2827
<BaseOutputPath Condition="'$(BaseOutputPath)' == ''">bin\</BaseOutputPath>
2928
<OutputPath Condition="'$(OutputPath)' == '' and '$(PlatformName)' == 'AnyCPU'">$(BaseOutputPath)$(Configuration)\</OutputPath>

eng/targets/Helix.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
117117
<TestAssembly>$(TargetFileName)</TestAssembly>
118118
<PreCommands>@(HelixPreCommand)</PreCommands>
119119
<PostCommands>@(HelixPostCommand)</PostCommands>
120-
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) Microsoft.AspNetCore.App.Runtime.win-x64.$(AppRuntimeVersion).nupkg Microsoft.AspNetCore.App.Ref.$(AppRuntimeVersion).nupkg $(HelixTimeout)</Command>
121-
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) Microsoft.AspNetCore.App.Runtime.win-x64.$(AppRuntimeVersion).nupkg Microsoft.AspNetCore.App.Ref.$(AppRuntimeVersion).nupkg $(HelixTimeout)</Command>
120+
<Command Condition="$(IsWindowsHelixQueue)">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)</Command>
121+
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) Microsoft.AspNetCore.App.Runtime.win-x64.$(AppRuntimeVersion).nupkg Microsoft.AspNetCore.App.Ref.$(AppRuntimeVersion).nupkg $(HelixTimeout)</Command>
122122
<Command Condition="$(HelixCommand) != ''">$(HelixCommand)</Command>
123123
<Timeout>$(HelixTimeout)</Timeout>
124124
</HelixWorkItem>

0 commit comments

Comments
 (0)