Skip to content

Commit

Permalink
Do not pass package filenames on Helix command Lines
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
dougbu committed Sep 11, 2020
1 parent a810fae commit 958eccb
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 48 deletions.
67 changes: 32 additions & 35 deletions eng/helix/content/RunTests/RunTestsOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,51 +46,48 @@ public static RunTestsOptions Parse(string[] args)
description: "The version of the EF tool to use")
{ Argument = new Argument<string>(), Required = true },

new Option(
aliases: new string[] { "--aspnetruntime" },
description: "The path to the aspnet runtime nupkg to install")
{ Argument = new Argument<string>(), Required = true },

new Option(
aliases: new string[] { "--aspnetref" },
description: "The path to the aspnet ref nupkg to install")
{ Argument = new Argument<string>(), Required = true },

new Option(
aliases: new string[] { "--helixTimeout" },
description: "The timeout duration of the Helix job")
{ Argument = new Argument<string>(), Required = true },
};

var parseResult = command.Parse(args);
var options = new RunTestsOptions();
options.Target = parseResult.ValueForOption<string>("--target");
options.RuntimeVersion = parseResult.ValueForOption<string>("--runtime");
options.HelixQueue = parseResult.ValueForOption<string>("--queue");
options.Architecture = parseResult.ValueForOption<string>("--arch");
options.Quarantined = parseResult.ValueForOption<bool>("--quarantined");
options.EfVersion = parseResult.ValueForOption<string>("--ef");
options.AspNetRuntime = parseResult.ValueForOption<string>("--aspnetruntime");
options.AspNetRef = parseResult.ValueForOption<string>("--aspnetref");
options.Timeout = TimeSpan.Parse(parseResult.ValueForOption<string>("--helixTimeout"));
options.HELIX_WORKITEM_ROOT = Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT");
options.Path = Environment.GetEnvironmentVariable("PATH");
options.DotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT");
var sharedFxVersion = parseResult.ValueForOption<string>("--runtime");
var options = new RunTestsOptions
{
Architecture = parseResult.ValueForOption<string>("--arch"),
EfVersion = parseResult.ValueForOption<string>("--ef"),
HelixQueue = parseResult.ValueForOption<string>("--queue"),
Quarantined = parseResult.ValueForOption<bool>("--quarantined"),
RuntimeVersion = sharedFxVersion,
Target = parseResult.ValueForOption<string>("--target"),
Timeout = TimeSpan.Parse(parseResult.ValueForOption<string>("--helixTimeout")),

// When targeting pack builds, it has exactly the same version as the shared framework.
AspNetRef = $" Microsoft.AspNetCore.App.Runtime.win-x64.{sharedFxVersion}.nupkg",
AspNetRuntime = $"Microsoft.AspNetCore.App.Ref.{sharedFxVersion}.nupkg",

DotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT"),
HELIX_WORKITEM_ROOT = Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT"),
Path = Environment.GetEnvironmentVariable("PATH"),
};

return options;
}

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;}
public string HelixQueue { get; set;}
public string Architecture { get; set;}
public bool Quarantined { get; set;}
public string EfVersion { get; set;}
public string HELIX_WORKITEM_ROOT { get; set;}
public string DotnetRoot { get; set; }
public string Architecture { get; private set; }
public string EfVersion { get; private set; }
public string HelixQueue { get; private set; }
public bool Quarantined { get; private set; }
public string RuntimeVersion { get; private set; }
public string Target { get; private set; }
public TimeSpan Timeout { get; private set; }

public string AspNetRef { get; private set; }
public string AspNetRuntime { get; private set; }
public string HELIX_WORKITEM_ROOT { get; private set; }
public string DotnetRoot { get; private set; }
public string Path { get; set; }
public TimeSpan Timeout { get; set; }
}
}
10 changes: 3 additions & 7 deletions eng/helix/content/runtests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ set $queue=%5
set $arch=%6
set $quarantined=%7
set $ef=%8
set $aspnetruntime=%9
REM Batch only supports up to 9 arguments using the %# syntax, need to shift to get more
shift
set $aspnetref=%9
shift
set $helixTimeout=%9
REM Batch only supports up to 9 arguments using the %# syntax, need to shift to get more
shift
set $feedCred=%9

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

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%"
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%
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%"
dotnet run --no-restore --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --helixTimeout %$helixTimeout%
if errorlevel neq 0 (
set exit_code=%errorlevel%
)
Expand Down
8 changes: 4 additions & 4 deletions eng/helix/content/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ InstallDotNet $DOTNET_ROOT $dotnet_sdk_version "" "" true || {
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2
ExitWithExitCode $exit_code
}
if [[ -z "${11:-}" ]]; then
if [[ -z "${10:-}" ]]; then
InstallDotNet $DOTNET_ROOT $dotnet_runtime_version "" dotnet true || {
exit_code=$?
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2
ExitWithExitCode $exit_code
}
else
InstallDotNet $DOTNET_ROOT $dotnet_runtime_version "" dotnet true https://dotnetclimsrc.blob.core.windows.net/dotnet ${11} || {
InstallDotNet $DOTNET_ROOT $dotnet_runtime_version "" dotnet true https://dotnetclimsrc.blob.core.windows.net/dotnet ${10} || {
exit_code=$?
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2
ExitWithExitCode $exit_code
Expand All @@ -65,8 +65,8 @@ exit_code=0
echo "Restore: $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --ignore-failed-sources"
$DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --ignore-failed-sources

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}"
$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}
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"
$DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --helixTimeout $9
exit_code=$?
echo "Finished tests...exit_code=$exit_code"

Expand Down
4 changes: 2 additions & 2 deletions eng/targets/Helix.targets
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
When the targeting pack builds, it has exactly the same version as the shared framework. Passing
SharedFxVersion because that's needed even when the targeting pack isn't building.
-->
<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>
<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>
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) $(HelixTimeout) $(DotNetRuntimeSourceFeedKey)</Command>
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) $(HelixTimeout) $(DotNetRuntimeSourceFeedKey)</Command>
<Command Condition="$(HelixCommand) != ''">$(HelixCommand)</Command>
<Timeout>$(HelixTimeout)</Timeout>
</HelixWorkItem>
Expand Down

0 comments on commit 958eccb

Please sign in to comment.