Skip to content

Commit 76ce84d

Browse files
committed
Do not pass package filenames on Helix command Lines
- remove parsing of these command-line arguments from `RuntestOptions` - instead craft the names using passed `$(SharedFxVersion)` - restore `$(DotNetRuntimeSourceFeedKey)` on Helix command line - lost somewhere along the line - correct argument count in runtests.sh - treated 11th argument as both Helix timeout and feed credential - count was messed up somewhere alone the line nits: - update C# syntax in `RuntestOptions` e.g. remove unused `public` setters - sort and group properties and their assignments
1 parent 75632bb commit 76ce84d

File tree

4 files changed

+41
-48
lines changed

4 files changed

+41
-48
lines changed

Diff for: eng/helix/content/RunTests/RunTestsOptions.cs

+32-35
Original file line numberDiff line numberDiff line change
@@ -46,51 +46,48 @@ public static RunTestsOptions Parse(string[] args)
4646
description: "The version of the EF tool to use")
4747
{ Argument = new Argument<string>(), Required = true },
4848

49-
new Option(
50-
aliases: new string[] { "--aspnetruntime" },
51-
description: "The path to the aspnet runtime nupkg to install")
52-
{ Argument = new Argument<string>(), Required = true },
53-
54-
new Option(
55-
aliases: new string[] { "--aspnetref" },
56-
description: "The path to the aspnet ref nupkg to install")
57-
{ Argument = new Argument<string>(), Required = true },
58-
5949
new Option(
6050
aliases: new string[] { "--helixTimeout" },
6151
description: "The timeout duration of the Helix job")
6252
{ Argument = new Argument<string>(), Required = true },
6353
};
6454

6555
var parseResult = command.Parse(args);
66-
var options = new RunTestsOptions();
67-
options.Target = parseResult.ValueForOption<string>("--target");
68-
options.RuntimeVersion = parseResult.ValueForOption<string>("--runtime");
69-
options.HelixQueue = parseResult.ValueForOption<string>("--queue");
70-
options.Architecture = parseResult.ValueForOption<string>("--arch");
71-
options.Quarantined = parseResult.ValueForOption<bool>("--quarantined");
72-
options.EfVersion = parseResult.ValueForOption<string>("--ef");
73-
options.AspNetRuntime = parseResult.ValueForOption<string>("--aspnetruntime");
74-
options.AspNetRef = parseResult.ValueForOption<string>("--aspnetref");
75-
options.Timeout = TimeSpan.Parse(parseResult.ValueForOption<string>("--helixTimeout"));
76-
options.HELIX_WORKITEM_ROOT = Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT");
77-
options.Path = Environment.GetEnvironmentVariable("PATH");
78-
options.DotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT");
56+
var sharedFxVersion = parseResult.ValueForOption<string>("--runtime");
57+
var options = new RunTestsOptions
58+
{
59+
Architecture = parseResult.ValueForOption<string>("--arch"),
60+
EfVersion = parseResult.ValueForOption<string>("--ef"),
61+
HelixQueue = parseResult.ValueForOption<string>("--queue"),
62+
Quarantined = parseResult.ValueForOption<bool>("--quarantined"),
63+
RuntimeVersion = sharedFxVersion,
64+
Target = parseResult.ValueForOption<string>("--target"),
65+
Timeout = TimeSpan.Parse(parseResult.ValueForOption<string>("--helixTimeout")),
66+
67+
// When targeting pack builds, it has exactly the same version as the shared framework.
68+
AspNetRef = $"Microsoft.AspNetCore.App.Ref.{sharedFxVersion}.nupkg",
69+
AspNetRuntime = $"Microsoft.AspNetCore.App.Runtime.win-x64.{sharedFxVersion}.nupkg",
70+
71+
DotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT"),
72+
HELIX_WORKITEM_ROOT = Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT"),
73+
Path = Environment.GetEnvironmentVariable("PATH"),
74+
};
75+
7976
return options;
8077
}
8178

82-
public string Target { get; set;}
83-
public string SdkVersion { get; set;}
84-
public string RuntimeVersion { get; set;}
85-
public string AspNetRuntime { get; set;}
86-
public string AspNetRef { get; set;}
87-
public string HelixQueue { get; set;}
88-
public string Architecture { get; set;}
89-
public bool Quarantined { get; set;}
90-
public string EfVersion { get; set;}
91-
public string HELIX_WORKITEM_ROOT { get; set;}
92-
public string DotnetRoot { get; set; }
79+
public string Architecture { get; private set; }
80+
public string EfVersion { get; private set; }
81+
public string HelixQueue { get; private set; }
82+
public bool Quarantined { get; private set; }
83+
public string RuntimeVersion { get; private set; }
84+
public string Target { get; private set; }
85+
public TimeSpan Timeout { get; private set; }
86+
87+
public string AspNetRef { get; private set; }
88+
public string AspNetRuntime { get; private set; }
89+
public string HELIX_WORKITEM_ROOT { get; private set; }
90+
public string DotnetRoot { get; private set; }
9391
public string Path { get; set; }
94-
public TimeSpan Timeout { get; set; }
9592
}
9693
}

Diff for: eng/helix/content/runtests.cmd

+3-7
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ set $queue=%5
1010
set $arch=%6
1111
set $quarantined=%7
1212
set $ef=%8
13-
set $aspnetruntime=%9
14-
REM Batch only supports up to 9 arguments using the %# syntax, need to shift to get more
15-
shift
16-
set $aspnetref=%9
17-
shift
1813
set $helixTimeout=%9
14+
REM Batch only supports up to 9 arguments using the %# syntax, need to shift to get more
1915
shift
2016
set $feedCred=%9
2117

@@ -40,8 +36,8 @@ set exit_code=0
4036
echo "Restore: dotnet restore RunTests\RunTests.csproj --ignore-failed-sources"
4137
dotnet restore RunTests\RunTests.csproj --ignore-failed-sources
4238

43-
echo "Running tests: dotnet run --no-restore --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%"
44-
dotnet run --no-restore --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%
39+
echo "Running tests: dotnet run --no-restore --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --helixTimeout %$helixTimeout%"
40+
dotnet run --no-restore --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --helixTimeout %$helixTimeout%
4541
if errorlevel neq 0 (
4642
set exit_code=%errorlevel%
4743
)

Diff for: eng/helix/content/runtests.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ InstallDotNet $DOTNET_ROOT $dotnet_sdk_version "" "" true || {
3636
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2
3737
ExitWithExitCode $exit_code
3838
}
39-
if [[ -z "${11:-}" ]]; then
39+
if [[ -z "${10:-}" ]]; then
4040
InstallDotNet $DOTNET_ROOT $dotnet_runtime_version "" dotnet true || {
4141
exit_code=$?
4242
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2
4343
ExitWithExitCode $exit_code
4444
}
4545
else
46-
InstallDotNet $DOTNET_ROOT $dotnet_runtime_version "" dotnet true https://dotnetclimsrc.blob.core.windows.net/dotnet ${11} || {
46+
InstallDotNet $DOTNET_ROOT $dotnet_runtime_version "" dotnet true https://dotnetclimsrc.blob.core.windows.net/dotnet ${10} || {
4747
exit_code=$?
4848
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2
4949
ExitWithExitCode $exit_code
@@ -65,8 +65,8 @@ exit_code=0
6565
echo "Restore: $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --ignore-failed-sources"
6666
$DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --ignore-failed-sources
6767

68-
echo "Running tests: $DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --aspnetruntime $9 --aspnetref ${10} --helixTimeout ${11}"
69-
$DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --aspnetruntime $9 --aspnetref ${10} --helixTimeout ${11}
68+
echo "Running tests: $DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --helixTimeout $9"
69+
$DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --helixTimeout $9
7070
exit_code=$?
7171
echo "Finished tests...exit_code=$exit_code"
7272

Diff for: eng/targets/Helix.targets

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
137137
When the targeting pack builds, it has exactly the same version as the shared framework. Passing
138138
SharedFxVersion because that's needed even when the targeting pack isn't building.
139139
-->
140-
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) Microsoft.AspNetCore.App.Runtime.win-x64.$(SharedFxVersion).nupkg Microsoft.AspNetCore.App.Ref.$(TargetingPackVersion).nupkg $(HelixTimeout)</Command>
141-
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) Microsoft.AspNetCore.App.Runtime.win-x64.$(SharedFxVersion).nupkg Microsoft.AspNetCore.App.Ref.$(TargetingPackVersion).nupkg $(HelixTimeout)</Command>
140+
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) $(HelixTimeout) $(DotNetRuntimeSourceFeedKey)</Command>
141+
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) $(HelixTimeout) $(DotNetRuntimeSourceFeedKey)</Command>
142142
<Command Condition="$(HelixCommand) != ''">$(HelixCommand)</Command>
143143
<Timeout>$(HelixTimeout)</Timeout>
144144
</HelixWorkItem>

0 commit comments

Comments
 (0)