Compare commits

..

4 Commits

Author SHA1 Message Date
Thomas Boop
2247f2e3ea 2.160.1 Runner Release Notes (#171)
* 2.160.1 Runner Release Notes

* Minor verbiage updates to be consistent
2019-11-05 15:43:40 -05:00
Thomas Boop
81fe044a22 Cache Feature Bug: Job Container stops before post actions are run breaking Cache (#167)
* stop job container after all post actions.

* c

* c
2019-11-05 15:43:05 -05:00
Thomas Boop
3ba55f86a9 add-mask is leaking a secret in master if debug or ::echo::on is set (#158)
* Output after processing command to avoid leaking mask

* Remove extra noise output from echo changes

* Omit Echoing of add-mask command

* avoid echoing on debug/warning/error
2019-11-04 14:31:21 -05:00
eric sciple
61f9d3f656 cherry picks from master (#156)
* Update dotnet install script (#155)

* root search pattern for hashfiles and allow forward slash on windows (#151)
2019-10-30 14:46:40 -04:00
29 changed files with 220 additions and 245 deletions

View File

@@ -1,12 +1,12 @@
# Contribution guide for developers # Contribute (Dev)
## Required Dev Dependencies ## Dev Dependencies
![Win](res/win_sm.png) Git for Windows [Install Here](https://git-scm.com/downloads) (needed for dev sh script) ![Win](res/win_sm.png) Git for Windows [Install Here](https://git-scm.com/downloads) (needed for dev sh script)
## To Build, Test, Layout ## Build, Test, Layout
Navigate to the `src` directory and run the following command: From src:
![Win](res/win_sm.png) `dev {command}` ![Win](res/win_sm.png) `dev {command}`
@@ -14,12 +14,13 @@ Navigate to the `src` directory and run the following command:
**Commands:** **Commands:**
* `layout` (`l`): Run first time to create a full agent layout in `{root}/_layout` `layout` (`l`): Run first time to create a full agent layout in {root}/_layout
* `build` (`b`): Build everything and update agent layout folder
* `test` (`t`): Build agent binaries and run unit tests
Sample developer flow: `build` (`b`): build everything and update agent layout folder
`test` (`t`): build agent binaries and run unit tests
Normal dev flow:
```bash ```bash
git clone https://github.com/actions/runner git clone https://github.com/actions/runner
cd ./src cd ./src
@@ -36,5 +37,5 @@ cd ./src
## Styling ## Styling
We use the .NET Foundation and CoreCLR style guidelines [located here]( We use the dotnet foundation and CoreCLR style guidelines [located here](
https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md) https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md)

View File

@@ -1,12 +1,15 @@
## Features ## Features
- N/A - Added commands to enable or disable echoing of commands (#139)
## Bugs ## Bugs
- Reverted removal of additional fields error and warning fields (#147) - Do not retry uploads on 4xx Errors for Artifact Upload Service (#131)
- Actions cache would incorrectly cache the action if the tag was updated (#148) - Actions cache no longer incorrectly caches the action if the tag was updated for self hosted runners (#148)
- Disabled echoing of commands on add-mask, debug, warning and error commands (#158)
- HashFile now is correctly configured to only support basic globbing and globstar (#149)
- HashFile now sets a default root and handles Windows paths correctly (#151)
## Misc ## Misc
- Updated to .NET Core 3.0 (#127) - N/A
## Agent Downloads ## Agent Downloads

View File

@@ -146,9 +146,3 @@ fi
if [[ "$PACKAGERUNTIME" == "linux-arm" ]]; then if [[ "$PACKAGERUNTIME" == "linux-arm" ]]; then
acquireExternalTool "$NODE_URL/v${NODE12_VERSION}/node-v${NODE12_VERSION}-linux-armv7l.tar.gz" node12 fix_nested_dir acquireExternalTool "$NODE_URL/v${NODE12_VERSION}/node-v${NODE12_VERSION}-linux-armv7l.tar.gz" node12 fix_nested_dir
fi fi
if [[ "$PACKAGERUNTIME" == "linux-arm64" ]]; then
acquireExternalTool "$NODE_URL/v${NODE12_VERSION}/node-v${NODE12_VERSION}-linux-arm64.tar.gz" node12 fix_nested_dir
## TODO: alpine arm64 version node.js
fi

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;linux-arm64;rhel.6-x64;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback> <AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
<NoWarn>NU1701;NU1603</NoWarn> <NoWarn>NU1701;NU1603</NoWarn>
@@ -57,9 +57,6 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'">
<DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
@@ -69,7 +66,4 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;DEBUG;TRACE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View File

@@ -54,8 +54,6 @@ namespace GitHub.Runner.Common.Util
return "X64"; return "X64";
case Constants.Architecture.Arm: case Constants.Architecture.Arm:
return "ARM"; return "ARM";
case Constants.Architecture.Arm64:
return "ARM64";
default: default:
throw new NotSupportedException(); // Should never reach here. throw new NotSupportedException(); // Should never reach here.
} }

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;linux-arm64;rhel.6-x64;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback> <AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
<NoWarn>NU1701;NU1603</NoWarn> <NoWarn>NU1701;NU1603</NoWarn>
@@ -60,9 +60,6 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'">
<DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
@@ -72,7 +69,4 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;DEBUG;TRACE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;linux-arm64;rhel.6-x64;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback> <AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
<NoWarn>NU1701;NU1603</NoWarn> <NoWarn>NU1701;NU1603</NoWarn>
@@ -53,9 +53,6 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'">
<DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
@@ -65,7 +62,4 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;DEBUG;TRACE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;linux-arm64;rhel.6-x64;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback> <AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
<NoWarn>NU1701;NU1603</NoWarn> <NoWarn>NU1701;NU1603</NoWarn>
@@ -49,9 +49,6 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'">
<DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
@@ -61,7 +58,4 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;DEBUG;TRACE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;linux-arm64;rhel.6-x64;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback> <AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
<NoWarn>NU1701;NU1603</NoWarn> <NoWarn>NU1701;NU1603</NoWarn>
@@ -54,9 +54,6 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'">
<DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
@@ -66,7 +63,4 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;DEBUG;TRACE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View File

@@ -73,7 +73,7 @@ namespace GitHub.Runner.Worker
return false; return false;
} }
// process action command in serialize oreder. // process action command in serialize order.
lock (_commandSerializeLock) lock (_commandSerializeLock)
{ {
if (_stopProcessCommand) if (_stopProcessCommand)
@@ -107,32 +107,19 @@ namespace GitHub.Runner.Worker
} }
else if (_commandExtensions.TryGetValue(actionCommand.Command, out IActionCommandExtension extension)) else if (_commandExtensions.TryGetValue(actionCommand.Command, out IActionCommandExtension extension))
{ {
bool commandHasBeenOutput = false; if (context.EchoOnActionCommand && !extension.OmitEcho)
{
context.Output(input);
}
try try
{ {
if (context.EchoOnActionCommand)
{
context.Output(input);
context.Debug($"Processing command '{actionCommand.Command}'");
commandHasBeenOutput = true;
}
extension.ProcessCommand(context, input, actionCommand); extension.ProcessCommand(context, input, actionCommand);
if (context.EchoOnActionCommand)
{
context.Debug($"Processed command '{actionCommand.Command}' successfully");
}
} }
catch (Exception ex) catch (Exception ex)
{ {
if (!commandHasBeenOutput) var commandInformation = extension.OmitEcho ? extension.Command : input;
{ context.Error($"Unable to process command '{commandInformation}' successfully.");
context.Output(input);
}
context.Error($"Unable to process command '{input}' successfully.");
context.Error(ex); context.Error(ex);
context.CommandResult = TaskResult.Failed; context.CommandResult = TaskResult.Failed;
} }
@@ -151,6 +138,7 @@ namespace GitHub.Runner.Worker
public interface IActionCommandExtension : IExtension public interface IActionCommandExtension : IExtension
{ {
string Command { get; } string Command { get; }
bool OmitEcho { get; }
void ProcessCommand(IExecutionContext context, string line, ActionCommand command); void ProcessCommand(IExecutionContext context, string line, ActionCommand command);
} }
@@ -158,6 +146,7 @@ namespace GitHub.Runner.Worker
public sealed class InternalPluginSetRepoPathCommandExtension : RunnerService, IActionCommandExtension public sealed class InternalPluginSetRepoPathCommandExtension : RunnerService, IActionCommandExtension
{ {
public string Command => "internal-set-repo-path"; public string Command => "internal-set-repo-path";
public bool OmitEcho => false;
public Type ExtensionType => typeof(IActionCommandExtension); public Type ExtensionType => typeof(IActionCommandExtension);
@@ -187,6 +176,7 @@ namespace GitHub.Runner.Worker
public sealed class SetEnvCommandExtension : RunnerService, IActionCommandExtension public sealed class SetEnvCommandExtension : RunnerService, IActionCommandExtension
{ {
public string Command => "set-env"; public string Command => "set-env";
public bool OmitEcho => false;
public Type ExtensionType => typeof(IActionCommandExtension); public Type ExtensionType => typeof(IActionCommandExtension);
@@ -211,6 +201,7 @@ namespace GitHub.Runner.Worker
public sealed class SetOutputCommandExtension : RunnerService, IActionCommandExtension public sealed class SetOutputCommandExtension : RunnerService, IActionCommandExtension
{ {
public string Command => "set-output"; public string Command => "set-output";
public bool OmitEcho => false;
public Type ExtensionType => typeof(IActionCommandExtension); public Type ExtensionType => typeof(IActionCommandExtension);
@@ -234,6 +225,7 @@ namespace GitHub.Runner.Worker
public sealed class SaveStateCommandExtension : RunnerService, IActionCommandExtension public sealed class SaveStateCommandExtension : RunnerService, IActionCommandExtension
{ {
public string Command => "save-state"; public string Command => "save-state";
public bool OmitEcho => false;
public Type ExtensionType => typeof(IActionCommandExtension); public Type ExtensionType => typeof(IActionCommandExtension);
@@ -257,6 +249,7 @@ namespace GitHub.Runner.Worker
public sealed class AddMaskCommandExtension : RunnerService, IActionCommandExtension public sealed class AddMaskCommandExtension : RunnerService, IActionCommandExtension
{ {
public string Command => "add-mask"; public string Command => "add-mask";
public bool OmitEcho => true;
public Type ExtensionType => typeof(IActionCommandExtension); public Type ExtensionType => typeof(IActionCommandExtension);
@@ -268,6 +261,11 @@ namespace GitHub.Runner.Worker
} }
else else
{ {
if (context.EchoOnActionCommand)
{
context.Output($"::{Command}::***");
}
HostContext.SecretMasker.AddValue(command.Data); HostContext.SecretMasker.AddValue(command.Data);
Trace.Info($"Add new secret mask with length of {command.Data.Length}"); Trace.Info($"Add new secret mask with length of {command.Data.Length}");
} }
@@ -277,6 +275,7 @@ namespace GitHub.Runner.Worker
public sealed class AddPathCommandExtension : RunnerService, IActionCommandExtension public sealed class AddPathCommandExtension : RunnerService, IActionCommandExtension
{ {
public string Command => "add-path"; public string Command => "add-path";
public bool OmitEcho => false;
public Type ExtensionType => typeof(IActionCommandExtension); public Type ExtensionType => typeof(IActionCommandExtension);
@@ -291,6 +290,7 @@ namespace GitHub.Runner.Worker
public sealed class AddMatcherCommandExtension : RunnerService, IActionCommandExtension public sealed class AddMatcherCommandExtension : RunnerService, IActionCommandExtension
{ {
public string Command => "add-matcher"; public string Command => "add-matcher";
public bool OmitEcho => false;
public Type ExtensionType => typeof(IActionCommandExtension); public Type ExtensionType => typeof(IActionCommandExtension);
@@ -337,6 +337,7 @@ namespace GitHub.Runner.Worker
public sealed class RemoveMatcherCommandExtension : RunnerService, IActionCommandExtension public sealed class RemoveMatcherCommandExtension : RunnerService, IActionCommandExtension
{ {
public string Command => "remove-matcher"; public string Command => "remove-matcher";
public bool OmitEcho => false;
public Type ExtensionType => typeof(IActionCommandExtension); public Type ExtensionType => typeof(IActionCommandExtension);
@@ -404,6 +405,7 @@ namespace GitHub.Runner.Worker
public sealed class DebugCommandExtension : RunnerService, IActionCommandExtension public sealed class DebugCommandExtension : RunnerService, IActionCommandExtension
{ {
public string Command => "debug"; public string Command => "debug";
public bool OmitEcho => true;
public Type ExtensionType => typeof(IActionCommandExtension); public Type ExtensionType => typeof(IActionCommandExtension);
@@ -431,6 +433,7 @@ namespace GitHub.Runner.Worker
{ {
public abstract IssueType Type { get; } public abstract IssueType Type { get; }
public abstract string Command { get; } public abstract string Command { get; }
public bool OmitEcho => true;
public Type ExtensionType => typeof(IActionCommandExtension); public Type ExtensionType => typeof(IActionCommandExtension);
@@ -510,6 +513,8 @@ namespace GitHub.Runner.Worker
public abstract class GroupingCommandExtension : RunnerService, IActionCommandExtension public abstract class GroupingCommandExtension : RunnerService, IActionCommandExtension
{ {
public abstract string Command { get; } public abstract string Command { get; }
public bool OmitEcho => false;
public Type ExtensionType => typeof(IActionCommandExtension); public Type ExtensionType => typeof(IActionCommandExtension);
public void ProcessCommand(IExecutionContext context, string line, ActionCommand command) public void ProcessCommand(IExecutionContext context, string line, ActionCommand command)
@@ -522,6 +527,7 @@ namespace GitHub.Runner.Worker
public sealed class EchoCommandExtension : RunnerService, IActionCommandExtension public sealed class EchoCommandExtension : RunnerService, IActionCommandExtension
{ {
public string Command => "echo"; public string Command => "echo";
public bool OmitEcho => false;
public Type ExtensionType => typeof(IActionCommandExtension); public Type ExtensionType => typeof(IActionCommandExtension);
@@ -541,6 +547,7 @@ namespace GitHub.Runner.Worker
break; break;
default: default:
throw new Exception($"Invalid echo command value. Possible values can be: 'on', 'off'. Current value is: '{command.Data}'."); throw new Exception($"Invalid echo command value. Possible values can be: 'on', 'off'. Current value is: '{command.Data}'.");
break;
} }
} }
} }

View File

@@ -276,9 +276,7 @@ namespace GitHub.Runner.Worker.Container
return await ExecuteDockerCommandAsync(context, "exec", $"{options} {containerId} {command}", context.CancellationToken); return await ExecuteDockerCommandAsync(context, "exec", $"{options} {containerId} {command}", context.CancellationToken);
} }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously (method has async logic on only certain platforms)
public async Task<int> DockerExec(IExecutionContext context, string containerId, string options, string command, List<string> output) public async Task<int> DockerExec(IExecutionContext context, string containerId, string options, string command, List<string> output)
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
{ {
ArgUtil.NotNull(output, nameof(output)); ArgUtil.NotNull(output, nameof(output));
@@ -339,9 +337,7 @@ namespace GitHub.Runner.Worker.Container
return ExecuteDockerCommandAsync(context, command, options, null, cancellationToken); return ExecuteDockerCommandAsync(context, command, options, null, cancellationToken);
} }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously (method has async logic on only certain platforms)
private async Task<int> ExecuteDockerCommandAsync(IExecutionContext context, string command, string options, IDictionary<string, string> environment, EventHandler<ProcessDataReceivedEventArgs> stdoutDataReceived, EventHandler<ProcessDataReceivedEventArgs> stderrDataReceived, CancellationToken cancellationToken = default(CancellationToken)) private async Task<int> ExecuteDockerCommandAsync(IExecutionContext context, string command, string options, IDictionary<string, string> environment, EventHandler<ProcessDataReceivedEventArgs> stdoutDataReceived, EventHandler<ProcessDataReceivedEventArgs> stderrDataReceived, CancellationToken cancellationToken = default(CancellationToken))
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
{ {
string arg = $"{command} {options}".Trim(); string arg = $"{command} {options}".Trim();
context.Command($"{DockerPath} {arg}"); context.Command($"{DockerPath} {arg}");
@@ -366,9 +362,7 @@ namespace GitHub.Runner.Worker.Container
#endif #endif
} }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously (method has async logic on only certain platforms)
private async Task<int> ExecuteDockerCommandAsync(IExecutionContext context, string command, string options, string workingDirectory, CancellationToken cancellationToken = default(CancellationToken)) private async Task<int> ExecuteDockerCommandAsync(IExecutionContext context, string command, string options, string workingDirectory, CancellationToken cancellationToken = default(CancellationToken))
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
{ {
string arg = $"{command} {options}".Trim(); string arg = $"{command} {options}".Trim();
context.Command($"{DockerPath} {arg}"); context.Command($"{DockerPath} {arg}");

View File

@@ -31,9 +31,7 @@ namespace GitHub.Runner.Worker
public sealed class DiagnosticLogManager : RunnerService, IDiagnosticLogManager public sealed class DiagnosticLogManager : RunnerService, IDiagnosticLogManager
{ {
private static string DateTimeFormat = "yyyyMMdd-HHmmss"; private static string DateTimeFormat = "yyyyMMdd-HHmmss";
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously (method has async logic on only certain platforms)
public async Task UploadDiagnosticLogsAsync(IExecutionContext executionContext, public async Task UploadDiagnosticLogsAsync(IExecutionContext executionContext,
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
IExecutionContext parentContext, IExecutionContext parentContext,
Pipelines.AgentJobRequestMessage message, Pipelines.AgentJobRequestMessage message,
DateTime jobStartTimeUtc) DateTime jobStartTimeUtc)

View File

@@ -22,9 +22,7 @@ namespace GitHub.Runner.Worker.Handlers
{ {
public ContainerActionExecutionData Data { get; set; } public ContainerActionExecutionData Data { get; set; }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously (method has async logic on only certain platforms)
public async Task RunAsync(ActionRunStage stage) public async Task RunAsync(ActionRunStage stage)
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
{ {
// Validate args. // Validate args.
Trace.Entering(); Trace.Entering();

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;linux-arm64;rhel.6-x64;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback> <AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
<NoWarn>NU1701;NU1603</NoWarn> <NoWarn>NU1701;NU1603</NoWarn>
@@ -64,9 +64,6 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'">
<DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
@@ -76,7 +73,4 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;DEBUG;TRACE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;linux-arm64;rhel.6-x64;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback> <AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
<NoWarn>NU1701;NU1603</NoWarn> <NoWarn>NU1701;NU1603</NoWarn>

View File

@@ -47,8 +47,8 @@ namespace GitHub.Runner.Common.Tests
}); });
// Assert. // Assert.
Assert.Equal("***", hc.SecretMasker.MaskSecrets("secret value 1")); Assert.Equal(hc.SecretMasker.MaskSecrets("secret value 1"), "***");
Assert.Equal("***", hc.SecretMasker.MaskSecrets("secret value 2")); Assert.Equal(hc.SecretMasker.MaskSecrets("secret value 2"), "***");
} }
} }
@@ -90,9 +90,9 @@ namespace GitHub.Runner.Common.Tests
trace.Info("Args: {0}", clp.Args.Count); trace.Info("Args: {0}", clp.Args.Count);
Assert.True(clp.Args.Count == 2); Assert.True(clp.Args.Count == 2);
Assert.True(clp.Args.ContainsKey("arg1")); Assert.True(clp.Args.ContainsKey("arg1"));
Assert.Equal("arg1val", clp.Args["arg1"]); Assert.Equal(clp.Args["arg1"], "arg1val");
Assert.True(clp.Args.ContainsKey("arg2")); Assert.True(clp.Args.ContainsKey("arg2"));
Assert.Equal("arg2val", clp.Args["arg2"]); Assert.Equal(clp.Args["arg2"], "arg2val");
} }
} }
@@ -113,8 +113,8 @@ namespace GitHub.Runner.Common.Tests
trace.Info("Args: {0}", clp.Flags.Count); trace.Info("Args: {0}", clp.Flags.Count);
Assert.True(clp.Flags.Count == 2); Assert.True(clp.Flags.Count == 2);
Assert.Contains("flag1", clp.Flags); Assert.True(clp.Flags.Contains("flag1"));
Assert.Contains("flag2", clp.Flags); Assert.True(clp.Flags.Contains("flag2"));
} }
} }

View File

@@ -18,7 +18,6 @@ namespace GitHub.Runner.Common.Tests
"win-x86", "win-x86",
"linux-x64", "linux-x64",
"linux-arm", "linux-arm",
"linux-arm64",
"rhel.6-x64", "rhel.6-x64",
"osx-x64" "osx-x64"
}; };

View File

@@ -36,10 +36,10 @@ namespace GitHub.Runner.Common.Tests.Worker.Container
// Assert // Assert
Assert.NotNull(result0); Assert.NotNull(result0);
Assert.Equal(0, result0.Count); Assert.Equal(result0.Count, 0);
Assert.NotNull(result1); Assert.NotNull(result1);
Assert.Equal(1, result1.Count); Assert.Equal(result1.Count, 1);
var result1Port80Mapping = result1.Find(pm => var result1Port80Mapping = result1.Find(pm =>
string.Equals(pm.ContainerPort, "80") && string.Equals(pm.ContainerPort, "80") &&
string.Equals(pm.HostPort, "32881") && string.Equals(pm.HostPort, "32881") &&
@@ -48,10 +48,10 @@ namespace GitHub.Runner.Common.Tests.Worker.Container
Assert.NotNull(result1Port80Mapping); Assert.NotNull(result1Port80Mapping);
Assert.NotNull(result1Empty); Assert.NotNull(result1Empty);
Assert.Equal(0, result1Empty.Count); Assert.Equal(result1Empty.Count, 0);
Assert.NotNull(result2); Assert.NotNull(result2);
Assert.Equal(2, result2.Count); Assert.Equal(result2.Count, 2);
var result2Port80Mapping = result2.Find(pm => var result2Port80Mapping = result2.Find(pm =>
string.Equals(pm.ContainerPort, "80") && string.Equals(pm.ContainerPort, "80") &&
string.Equals(pm.HostPort, "32881") && string.Equals(pm.HostPort, "32881") &&

View File

@@ -107,7 +107,7 @@ namespace GitHub.Runner.Common.Tests
} }
} }
private void Setup([CallerMemberName] string testName = "") public void Setup([CallerMemberName] string testName = "")
{ {
_tokenSource = new CancellationTokenSource(); _tokenSource = new CancellationTokenSource();
_hc = new HostContext( _hc = new HostContext(
@@ -115,7 +115,7 @@ namespace GitHub.Runner.Common.Tests
logFile: Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), $"trace_{nameof(HostContextL0)}_{testName}.log")); logFile: Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), $"trace_{nameof(HostContextL0)}_{testName}.log"));
} }
private void Teardown() public void Teardown()
{ {
_hc?.Dispose(); _hc?.Dispose();
_tokenSource?.Dispose(); _tokenSource?.Dispose();

View File

@@ -52,7 +52,7 @@ namespace GitHub.Runner.Common.Tests
// Assert. // Assert.
Assert.Equal("some agent", actual); Assert.Equal("some agent", actual);
Assert.Equal(string.Empty, Environment.GetEnvironmentVariable("ACTIONS_RUNNER_INPUT_AGENT") ?? string.Empty); // Should remove. Assert.Equal(string.Empty, Environment.GetEnvironmentVariable("ACTIONS_RUNNER_INPUT_AGENT") ?? string.Empty); // Should remove.
Assert.Equal("some agent", hc.SecretMasker.MaskSecrets("some agent")); Assert.Equal(hc.SecretMasker.MaskSecrets("some agent"), "some agent");
} }
finally finally
{ {
@@ -80,7 +80,7 @@ namespace GitHub.Runner.Common.Tests
// Assert. // Assert.
Assert.Equal("some secret token value", actual); Assert.Equal("some secret token value", actual);
Assert.Equal(string.Empty, Environment.GetEnvironmentVariable("ACTIONS_RUNNER_INPUT_TOKEN") ?? string.Empty); // Should remove. Assert.Equal(string.Empty, Environment.GetEnvironmentVariable("ACTIONS_RUNNER_INPUT_TOKEN") ?? string.Empty); // Should remove.
Assert.Equal("***", hc.SecretMasker.MaskSecrets("some secret token value")); Assert.Equal(hc.SecretMasker.MaskSecrets("some secret token value"), "***");
} }
finally finally
{ {
@@ -250,7 +250,7 @@ namespace GitHub.Runner.Common.Tests
bool actual = command.Unattended; bool actual = command.Unattended;
// Assert. // Assert.
Assert.True(actual); Assert.Equal(true, actual);
Assert.Equal(string.Empty, Environment.GetEnvironmentVariable("ACTIONS_RUNNER_INPUT_UNATTENDED") ?? string.Empty); // Should remove. Assert.Equal(string.Empty, Environment.GetEnvironmentVariable("ACTIONS_RUNNER_INPUT_UNATTENDED") ?? string.Empty); // Should remove.
} }
finally finally
@@ -720,7 +720,7 @@ namespace GitHub.Runner.Common.Tests
var command = new CommandSettings(hc, args: new string[] { "badcommand" }); var command = new CommandSettings(hc, args: new string[] { "badcommand" });
// Assert. // Assert.
Assert.Contains("badcommand", command.Validate()); Assert.True(command.Validate().Contains("badcommand"));
} }
} }
@@ -735,7 +735,7 @@ namespace GitHub.Runner.Common.Tests
var command = new CommandSettings(hc, args: new string[] { "--badflag" }); var command = new CommandSettings(hc, args: new string[] { "--badflag" });
// Assert. // Assert.
Assert.Contains("badflag", command.Validate()); Assert.True(command.Validate().Contains("badflag"));
} }
} }
@@ -750,7 +750,7 @@ namespace GitHub.Runner.Common.Tests
var command = new CommandSettings(hc, args: new string[] { "--badargname", "bad arg value" }); var command = new CommandSettings(hc, args: new string[] { "--badargname", "bad arg value" });
// Assert. // Assert.
Assert.Contains("badargname", command.Validate()); Assert.True(command.Validate().Contains("badargname"));
} }
} }

View File

@@ -43,6 +43,10 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
private string _expectedServerUrl = "https://localhost"; private string _expectedServerUrl = "https://localhost";
private string _expectedAgentName = "expectedAgentName"; private string _expectedAgentName = "expectedAgentName";
private string _expectedPoolName = "poolName"; private string _expectedPoolName = "poolName";
private string _expectedCollectionName = "testCollectionName";
private string _expectedProjectName = "testProjectName";
private string _expectedProjectId = "edf3f94e-d251-49df-bfce-602d6c967409";
private string _expectedMachineGroupName = "testMachineGroupName";
private string _expectedAuthType = "pat"; private string _expectedAuthType = "pat";
private string _expectedWorkFolder = "_work"; private string _expectedWorkFolder = "_work";
private int _expectedPoolId = 1; private int _expectedPoolId = 1;

View File

@@ -64,7 +64,7 @@ namespace GitHub.Runner.Common.Tests.Listener
string line; string line;
while ((line = freader.ReadLine()) != null) while ((line = freader.ReadLine()) != null)
{ {
Assert.EndsWith(LogData, line); Assert.True(line.EndsWith(LogData));
bytesWritten += logDataSize; bytesWritten += logDataSize;
} }
} }

View File

@@ -31,8 +31,8 @@ namespace GitHub.Runner.Common.Tests.Util
var connect = VssUtil.CreateConnection(new Uri("https://github.com/actions/runner"), new VssCredentials()); var connect = VssUtil.CreateConnection(new Uri("https://github.com/actions/runner"), new VssCredentials());
// Assert. // Assert.
Assert.Equal("10", connect.Settings.MaxRetryRequest.ToString()); Assert.Equal(connect.Settings.MaxRetryRequest.ToString(), "10");
Assert.Equal("360", connect.Settings.SendTimeout.TotalSeconds.ToString()); Assert.Equal(connect.Settings.SendTimeout.TotalSeconds.ToString(), "360");
trace.Info("Set httpretry to 100."); trace.Info("Set httpretry to 100.");
Environment.SetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_HTTP_RETRY", "100"); Environment.SetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_HTTP_RETRY", "100");
@@ -42,8 +42,8 @@ namespace GitHub.Runner.Common.Tests.Util
connect = VssUtil.CreateConnection(new Uri("https://github.com/actions/runner"), new VssCredentials()); connect = VssUtil.CreateConnection(new Uri("https://github.com/actions/runner"), new VssCredentials());
// Assert. // Assert.
Assert.Equal("10", connect.Settings.MaxRetryRequest.ToString()); Assert.Equal(connect.Settings.MaxRetryRequest.ToString(), "10");
Assert.Equal("1200", connect.Settings.SendTimeout.TotalSeconds.ToString()); Assert.Equal(connect.Settings.SendTimeout.TotalSeconds.ToString(), "1200");
} }
finally finally
{ {

View File

@@ -37,25 +37,25 @@ namespace GitHub.Runner.Common.Tests.Worker
//Assert //Assert
Assert.Equal("Hello World", result.Name); Assert.Equal(result.Name, "Hello World");
Assert.Equal("Greet the world and record the time", result.Description); Assert.Equal(result.Description, "Greet the world and record the time");
Assert.Equal(2, result.Inputs.Count); Assert.Equal(result.Inputs.Count, 2);
Assert.Equal("greeting", result.Inputs[0].Key.AssertString("key").Value); Assert.Equal(result.Inputs[0].Key.AssertString("key").Value, "greeting");
Assert.Equal("Hello", result.Inputs[0].Value.AssertString("value").Value); Assert.Equal(result.Inputs[0].Value.AssertString("value").Value, "Hello");
Assert.Equal("entryPoint", result.Inputs[1].Key.AssertString("key").Value); Assert.Equal(result.Inputs[1].Key.AssertString("key").Value, "entryPoint");
Assert.Equal("", result.Inputs[1].Value.AssertString("value").Value); Assert.Equal(result.Inputs[1].Value.AssertString("value").Value, "");
Assert.Equal(ActionExecutionType.Container, result.Execution.ExecutionType); Assert.Equal(result.Execution.ExecutionType, ActionExecutionType.Container);
var containerAction = result.Execution as ContainerActionExecutionData; var containerAction = result.Execution as ContainerActionExecutionData;
Assert.Equal("Dockerfile", containerAction.Image); Assert.Equal(containerAction.Image, "Dockerfile");
Assert.Equal("main.sh", containerAction.EntryPoint); Assert.Equal(containerAction.EntryPoint, "main.sh");
Assert.Equal("bzz", containerAction.Arguments[0].ToString()); Assert.Equal(containerAction.Arguments[0].ToString(), "bzz");
Assert.Equal("Token", containerAction.Environment[0].Key.ToString()); Assert.Equal(containerAction.Environment[0].Key.ToString(), "Token");
Assert.Equal("foo", containerAction.Environment[0].Value.ToString()); Assert.Equal(containerAction.Environment[0].Value.ToString(), "foo");
Assert.Equal("Url", containerAction.Environment[1].Key.ToString()); Assert.Equal(containerAction.Environment[1].Key.ToString(), "Url");
Assert.Equal("bar", containerAction.Environment[1].Value.ToString()); Assert.Equal(containerAction.Environment[1].Value.ToString(), "bar");
} }
finally finally
{ {
@@ -81,27 +81,27 @@ namespace GitHub.Runner.Common.Tests.Worker
//Assert //Assert
Assert.Equal("Hello World", result.Name); Assert.Equal(result.Name, "Hello World");
Assert.Equal("Greet the world and record the time", result.Description); Assert.Equal(result.Description, "Greet the world and record the time");
Assert.Equal(2, result.Inputs.Count); Assert.Equal(result.Inputs.Count, 2);
Assert.Equal("greeting", result.Inputs[0].Key.AssertString("key").Value); Assert.Equal(result.Inputs[0].Key.AssertString("key").Value, "greeting");
Assert.Equal("Hello", result.Inputs[0].Value.AssertString("value").Value); Assert.Equal(result.Inputs[0].Value.AssertString("value").Value, "Hello");
Assert.Equal("entryPoint", result.Inputs[1].Key.AssertString("key").Value); Assert.Equal(result.Inputs[1].Key.AssertString("key").Value, "entryPoint");
Assert.Equal("", result.Inputs[1].Value.AssertString("value").Value); Assert.Equal(result.Inputs[1].Value.AssertString("value").Value, "");
Assert.Equal(ActionExecutionType.Container, result.Execution.ExecutionType); Assert.Equal(result.Execution.ExecutionType, ActionExecutionType.Container);
var containerAction = result.Execution as ContainerActionExecutionData; var containerAction = result.Execution as ContainerActionExecutionData;
Assert.Equal("Dockerfile", containerAction.Image); Assert.Equal(containerAction.Image, "Dockerfile");
Assert.Equal("main.sh", containerAction.EntryPoint); Assert.Equal(containerAction.EntryPoint, "main.sh");
Assert.Equal("cleanup.sh", containerAction.Cleanup); Assert.Equal(containerAction.Cleanup, "cleanup.sh");
Assert.Equal("failure()", containerAction.CleanupCondition); Assert.Equal(containerAction.CleanupCondition, "failure()");
Assert.Equal("bzz", containerAction.Arguments[0].ToString()); Assert.Equal(containerAction.Arguments[0].ToString(), "bzz");
Assert.Equal("Token", containerAction.Environment[0].Key.ToString()); Assert.Equal(containerAction.Environment[0].Key.ToString(), "Token");
Assert.Equal("foo", containerAction.Environment[0].Value.ToString()); Assert.Equal(containerAction.Environment[0].Value.ToString(), "foo");
Assert.Equal("Url", containerAction.Environment[1].Key.ToString()); Assert.Equal(containerAction.Environment[1].Key.ToString(), "Url");
Assert.Equal("bar", containerAction.Environment[1].Value.ToString()); Assert.Equal(containerAction.Environment[1].Value.ToString(), "bar");
} }
finally finally
{ {
@@ -126,19 +126,19 @@ namespace GitHub.Runner.Common.Tests.Worker
var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "dockerfileaction_noargs_noenv_noentrypoint.yml")); var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "dockerfileaction_noargs_noenv_noentrypoint.yml"));
//Assert //Assert
Assert.Equal("Hello World", result.Name); Assert.Equal(result.Name, "Hello World");
Assert.Equal("Greet the world and record the time", result.Description); Assert.Equal(result.Description, "Greet the world and record the time");
Assert.Equal(2, result.Inputs.Count); Assert.Equal(result.Inputs.Count, 2);
Assert.Equal("greeting", result.Inputs[0].Key.AssertString("key").Value); Assert.Equal(result.Inputs[0].Key.AssertString("key").Value, "greeting");
Assert.Equal("Hello", result.Inputs[0].Value.AssertString("value").Value); Assert.Equal(result.Inputs[0].Value.AssertString("value").Value, "Hello");
Assert.Equal("entryPoint", result.Inputs[1].Key.AssertString("key").Value); Assert.Equal(result.Inputs[1].Key.AssertString("key").Value, "entryPoint");
Assert.Equal("", result.Inputs[1].Value.AssertString("value").Value); Assert.Equal(result.Inputs[1].Value.AssertString("value").Value, "");
Assert.Equal(ActionExecutionType.Container, result.Execution.ExecutionType); Assert.Equal(result.Execution.ExecutionType, ActionExecutionType.Container);
var containerAction = result.Execution as ContainerActionExecutionData; var containerAction = result.Execution as ContainerActionExecutionData;
Assert.Equal("Dockerfile", containerAction.Image); Assert.Equal(containerAction.Image, "Dockerfile");
} }
finally finally
{ {
@@ -164,25 +164,25 @@ namespace GitHub.Runner.Common.Tests.Worker
//Assert //Assert
Assert.Equal("Hello World", result.Name); Assert.Equal(result.Name, "Hello World");
Assert.Equal("Greet the world and record the time", result.Description); Assert.Equal(result.Description, "Greet the world and record the time");
Assert.Equal(2, result.Inputs.Count); Assert.Equal(result.Inputs.Count, 2);
Assert.Equal("greeting", result.Inputs[0].Key.AssertString("key").Value); Assert.Equal(result.Inputs[0].Key.AssertString("key").Value, "greeting");
Assert.Equal("Hello", result.Inputs[0].Value.AssertString("value").Value); Assert.Equal(result.Inputs[0].Value.AssertString("value").Value, "Hello");
Assert.Equal("entryPoint", result.Inputs[1].Key.AssertString("key").Value); Assert.Equal(result.Inputs[1].Key.AssertString("key").Value, "entryPoint");
Assert.Equal("", result.Inputs[1].Value.AssertString("value").Value); Assert.Equal(result.Inputs[1].Value.AssertString("value").Value, "");
Assert.Equal(ActionExecutionType.Container, result.Execution.ExecutionType); Assert.Equal(result.Execution.ExecutionType, ActionExecutionType.Container);
var containerAction = result.Execution as ContainerActionExecutionData; var containerAction = result.Execution as ContainerActionExecutionData;
Assert.Equal("Dockerfile", containerAction.Image); Assert.Equal(containerAction.Image, "Dockerfile");
Assert.Equal("main.sh", containerAction.EntryPoint); Assert.Equal(containerAction.EntryPoint, "main.sh");
Assert.Equal("${{ inputs.greeting }}", containerAction.Arguments[0].ToString()); Assert.Equal(containerAction.Arguments[0].ToString(), "${{ inputs.greeting }}");
Assert.Equal("Token", containerAction.Environment[0].Key.ToString()); Assert.Equal(containerAction.Environment[0].Key.ToString(), "Token");
Assert.Equal("foo", containerAction.Environment[0].Value.ToString()); Assert.Equal(containerAction.Environment[0].Value.ToString(), "foo");
Assert.Equal("Url", containerAction.Environment[1].Key.ToString()); Assert.Equal(containerAction.Environment[1].Key.ToString(), "Url");
Assert.Equal("${{ inputs.entryPoint }}", containerAction.Environment[1].Value.ToString()); Assert.Equal(containerAction.Environment[1].Value.ToString(), "${{ inputs.entryPoint }}");
} }
finally finally
{ {
@@ -207,25 +207,25 @@ namespace GitHub.Runner.Common.Tests.Worker
var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "dockerhubaction.yml")); var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "dockerhubaction.yml"));
//Assert //Assert
Assert.Equal("Hello World", result.Name); Assert.Equal(result.Name, "Hello World");
Assert.Equal("Greet the world and record the time", result.Description); Assert.Equal(result.Description, "Greet the world and record the time");
Assert.Equal(2, result.Inputs.Count); Assert.Equal(result.Inputs.Count, 2);
Assert.Equal("greeting", result.Inputs[0].Key.AssertString("key").Value); Assert.Equal(result.Inputs[0].Key.AssertString("key").Value, "greeting");
Assert.Equal("Hello", result.Inputs[0].Value.AssertString("value").Value); Assert.Equal(result.Inputs[0].Value.AssertString("value").Value, "Hello");
Assert.Equal("entryPoint", result.Inputs[1].Key.AssertString("key").Value); Assert.Equal(result.Inputs[1].Key.AssertString("key").Value, "entryPoint");
Assert.Equal("", result.Inputs[1].Value.AssertString("value").Value); Assert.Equal(result.Inputs[1].Value.AssertString("value").Value, "");
Assert.Equal(ActionExecutionType.Container, result.Execution.ExecutionType); Assert.Equal(result.Execution.ExecutionType, ActionExecutionType.Container);
var containerAction = result.Execution as ContainerActionExecutionData; var containerAction = result.Execution as ContainerActionExecutionData;
Assert.Equal("docker://ubuntu:18.04", containerAction.Image); Assert.Equal(containerAction.Image, "docker://ubuntu:18.04");
Assert.Equal("main.sh", containerAction.EntryPoint); Assert.Equal(containerAction.EntryPoint, "main.sh");
Assert.Equal("bzz", containerAction.Arguments[0].ToString()); Assert.Equal(containerAction.Arguments[0].ToString(), "bzz");
Assert.Equal("Token", containerAction.Environment[0].Key.ToString()); Assert.Equal(containerAction.Environment[0].Key.ToString(), "Token");
Assert.Equal("foo", containerAction.Environment[0].Value.ToString()); Assert.Equal(containerAction.Environment[0].Value.ToString(), "foo");
Assert.Equal("Url", containerAction.Environment[1].Key.ToString()); Assert.Equal(containerAction.Environment[1].Key.ToString(), "Url");
Assert.Equal("bar", containerAction.Environment[1].Value.ToString()); Assert.Equal(containerAction.Environment[1].Value.ToString(), "bar");
} }
finally finally
{ {
@@ -250,24 +250,24 @@ namespace GitHub.Runner.Common.Tests.Worker
var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "nodeaction.yml")); var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "nodeaction.yml"));
//Assert //Assert
Assert.Equal("Hello World", result.Name); Assert.Equal(result.Name, "Hello World");
Assert.Equal("Greet the world and record the time", result.Description); Assert.Equal(result.Description, "Greet the world and record the time");
Assert.Equal(2, result.Inputs.Count); Assert.Equal(result.Inputs.Count, 2);
Assert.Equal("greeting", result.Inputs[0].Key.AssertString("key").Value); Assert.Equal(result.Inputs[0].Key.AssertString("key").Value, "greeting");
Assert.Equal("Hello", result.Inputs[0].Value.AssertString("value").Value); Assert.Equal(result.Inputs[0].Value.AssertString("value").Value, "Hello");
Assert.Equal("entryPoint", result.Inputs[1].Key.AssertString("key").Value); Assert.Equal(result.Inputs[1].Key.AssertString("key").Value, "entryPoint");
Assert.Equal("", result.Inputs[1].Value.AssertString("value").Value); Assert.Equal(result.Inputs[1].Value.AssertString("value").Value, "");
Assert.Equal(1, result.Deprecated.Count); Assert.Equal(result.Deprecated.Count, 1);
Assert.True(result.Deprecated.ContainsKey("greeting")); Assert.True(result.Deprecated.ContainsKey("greeting"));
result.Deprecated.TryGetValue("greeting", out string value); result.Deprecated.TryGetValue("greeting", out string value);
Assert.Equal("This property has been deprecated", value); Assert.Equal(value, "This property has been deprecated");
Assert.Equal(ActionExecutionType.NodeJS, result.Execution.ExecutionType); Assert.Equal(result.Execution.ExecutionType, ActionExecutionType.NodeJS);
var nodeAction = result.Execution as NodeJSActionExecutionData; var nodeAction = result.Execution as NodeJSActionExecutionData;
Assert.Equal("main.js", nodeAction.Script); Assert.Equal(nodeAction.Script, "main.js");
} }
finally finally
{ {
@@ -292,26 +292,26 @@ namespace GitHub.Runner.Common.Tests.Worker
var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "nodeaction_cleanup.yml")); var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "nodeaction_cleanup.yml"));
//Assert //Assert
Assert.Equal("Hello World", result.Name); Assert.Equal(result.Name, "Hello World");
Assert.Equal("Greet the world and record the time", result.Description); Assert.Equal(result.Description, "Greet the world and record the time");
Assert.Equal(2, result.Inputs.Count); Assert.Equal(result.Inputs.Count, 2);
Assert.Equal("greeting", result.Inputs[0].Key.AssertString("key").Value); Assert.Equal(result.Inputs[0].Key.AssertString("key").Value, "greeting");
Assert.Equal("Hello", result.Inputs[0].Value.AssertString("value").Value); Assert.Equal(result.Inputs[0].Value.AssertString("value").Value, "Hello");
Assert.Equal("entryPoint", result.Inputs[1].Key.AssertString("key").Value); Assert.Equal(result.Inputs[1].Key.AssertString("key").Value, "entryPoint");
Assert.Equal("", result.Inputs[1].Value.AssertString("value").Value); Assert.Equal(result.Inputs[1].Value.AssertString("value").Value, "");
Assert.Equal(1, result.Deprecated.Count); Assert.Equal(result.Deprecated.Count, 1);
Assert.True(result.Deprecated.ContainsKey("greeting")); Assert.True(result.Deprecated.ContainsKey("greeting"));
result.Deprecated.TryGetValue("greeting", out string value); result.Deprecated.TryGetValue("greeting", out string value);
Assert.Equal("This property has been deprecated", value); Assert.Equal(value, "This property has been deprecated");
Assert.Equal(ActionExecutionType.NodeJS, result.Execution.ExecutionType); Assert.Equal(result.Execution.ExecutionType, ActionExecutionType.NodeJS);
var nodeAction = result.Execution as NodeJSActionExecutionData; var nodeAction = result.Execution as NodeJSActionExecutionData;
Assert.Equal("main.js", nodeAction.Script); Assert.Equal(nodeAction.Script, "main.js");
Assert.Equal("cleanup.js", nodeAction.Cleanup); Assert.Equal(nodeAction.Cleanup, "cleanup.js");
Assert.Equal("cancelled()", nodeAction.CleanupCondition); Assert.Equal(nodeAction.CleanupCondition, "cancelled()");
} }
finally finally
{ {
@@ -336,19 +336,19 @@ namespace GitHub.Runner.Common.Tests.Worker
var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "pluginaction.yml")); var result = actionManifest.Load(_ec.Object, Path.Combine(TestUtil.GetTestDataPath(), "pluginaction.yml"));
//Assert //Assert
Assert.Equal("Hello World", result.Name); Assert.Equal(result.Name, "Hello World");
Assert.Equal("Greet the world and record the time", result.Description); Assert.Equal(result.Description, "Greet the world and record the time");
Assert.Equal(2, result.Inputs.Count); Assert.Equal(result.Inputs.Count, 2);
Assert.Equal("greeting", result.Inputs[0].Key.AssertString("key").Value); Assert.Equal(result.Inputs[0].Key.AssertString("key").Value, "greeting");
Assert.Equal("Hello", result.Inputs[0].Value.AssertString("value").Value); Assert.Equal(result.Inputs[0].Value.AssertString("value").Value, "Hello");
Assert.Equal("entryPoint", result.Inputs[1].Key.AssertString("key").Value); Assert.Equal(result.Inputs[1].Key.AssertString("key").Value, "entryPoint");
Assert.Equal("", result.Inputs[1].Value.AssertString("value").Value); Assert.Equal(result.Inputs[1].Value.AssertString("value").Value, "");
Assert.Equal(ActionExecutionType.Plugin, result.Execution.ExecutionType); Assert.Equal(result.Execution.ExecutionType, ActionExecutionType.Plugin);
var pluginAction = result.Execution as PluginActionExecutionData; var pluginAction = result.Execution as PluginActionExecutionData;
Assert.Equal("someplugin", pluginAction.Plugin); Assert.Equal(pluginAction.Plugin, "someplugin");
} }
finally finally
{ {
@@ -383,9 +383,9 @@ namespace GitHub.Runner.Common.Tests.Worker
var result = actionManifest.EvaluateContainerArguments(_ec.Object, arguments, evaluateContext); var result = actionManifest.EvaluateContainerArguments(_ec.Object, arguments, evaluateContext);
//Assert //Assert
Assert.Equal("hello", result[0]); Assert.Equal(result[0], "hello");
Assert.Equal("test", result[1]); Assert.Equal(result[1], "test");
Assert.Equal(2, result.Count); Assert.Equal(result.Count, 2);
} }
finally finally
{ {
@@ -420,9 +420,9 @@ namespace GitHub.Runner.Common.Tests.Worker
var result = actionManifest.EvaluateContainerEnvironment(_ec.Object, environment, evaluateContext); var result = actionManifest.EvaluateContainerEnvironment(_ec.Object, environment, evaluateContext);
//Assert //Assert
Assert.Equal("hello", result["hello"]); Assert.Equal(result["hello"], "hello");
Assert.Equal("test", result["test"]); Assert.Equal(result["test"], "test");
Assert.Equal(2, result.Count); Assert.Equal(result.Count, 2);
} }
finally finally
{ {
@@ -459,13 +459,13 @@ namespace GitHub.Runner.Common.Tests.Worker
var result = actionManifest.EvaluateDefaultInput(_ec.Object, "testInput", new StringToken(null, null, null, "defaultValue"), evaluateContext); var result = actionManifest.EvaluateDefaultInput(_ec.Object, "testInput", new StringToken(null, null, null, "defaultValue"), evaluateContext);
//Assert //Assert
Assert.Equal("defaultValue", result); Assert.Equal(result, "defaultValue");
//Act //Act
result = actionManifest.EvaluateDefaultInput(_ec.Object, "testInput", new BasicExpressionToken(null, null, null, "github.ref"), evaluateContext); result = actionManifest.EvaluateDefaultInput(_ec.Object, "testInput", new BasicExpressionToken(null, null, null, "github.ref"), evaluateContext);
//Assert //Assert
Assert.Equal("refs/heads/master", result); Assert.Equal(result, "refs/heads/master");
} }
finally finally
{ {

View File

@@ -31,6 +31,7 @@ namespace GitHub.Runner.Common.Tests.Worker
private TestHostContext _hc; private TestHostContext _hc;
private ActionRunner _actionRunner; private ActionRunner _actionRunner;
private IActionManifestManager _actionManifestManager; private IActionManifestManager _actionManifestManager;
private string _workFolder;
private DictionaryContextData _context = new DictionaryContextData(); private DictionaryContextData _context = new DictionaryContextData();
[Fact] [Fact]
@@ -74,9 +75,9 @@ namespace GitHub.Runner.Common.Tests.Worker
} }
//Assert //Assert
Assert.Equal("test1", finialInputs["input1"]); Assert.Equal(finialInputs["input1"], "test1");
Assert.Equal("test2", finialInputs["input2"]); Assert.Equal(finialInputs["input2"], "test2");
Assert.Equal("github", finialInputs["input3"]); Assert.Equal(finialInputs["input3"], "github");
} }
[Fact] [Fact]
@@ -277,6 +278,24 @@ namespace GitHub.Runner.Common.Tests.Worker
Assert.Equal("${{ matrix.node }}", _actionRunner.DisplayName); Assert.Equal("${{ matrix.node }}", _actionRunner.DisplayName);
} }
private void CreateAction(string yamlContent, out Pipelines.ActionStep instance, out string directory)
{
directory = Path.Combine(_workFolder, Constants.Path.ActionsDirectory, "GitHub/actions".Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar), "master");
string file = Path.Combine(directory, Constants.Path.ActionManifestFile);
Directory.CreateDirectory(Path.GetDirectoryName(file));
File.WriteAllText(file, yamlContent);
instance = new Pipelines.ActionStep()
{
Id = Guid.NewGuid(),
Reference = new Pipelines.RepositoryPathReference()
{
Name = "GitHub/actions",
Ref = "master",
RepositoryType = Pipelines.RepositoryTypes.GitHub
}
};
}
private void Setup([CallerMemberName] string name = "") private void Setup([CallerMemberName] string name = "")
{ {
_ecTokenSource?.Dispose(); _ecTokenSource?.Dispose();

View File

@@ -150,7 +150,7 @@ namespace GitHub.Runner.Common.Tests.Worker
string actual = variables.Get("no such"); string actual = variables.Get("no such");
// Assert. // Assert.
Assert.Null(actual); Assert.Equal(null, actual);
} }
} }

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;linux-arm64;rhel.6-x64;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback> <AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
<NoWarn>NU1701;NU1603;NU1603;xUnit2013;</NoWarn> <NoWarn>NU1701;NU1603;NU1603;xUnit2013;</NoWarn>
@@ -58,9 +58,6 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-x64'">
<DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;X64;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
@@ -70,7 +67,4 @@
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm'">
<DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants> <DefineConstants>OS_LINUX;ARM;DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(Configuration)' == 'Debug' AND '$(PackageRuntime)' == 'linux-arm64'">
<DefineConstants>OS_LINUX;ARM64;DEBUG;TRACE</DefineConstants>
</PropertyGroup>
</Project> </Project>

View File

@@ -43,7 +43,7 @@ elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then
CPU_NAME=$(uname -m) CPU_NAME=$(uname -m)
case $CPU_NAME in case $CPU_NAME in
armv7l) RUNTIME_ID="linux-arm";; armv7l) RUNTIME_ID="linux-arm";;
aarch64) RUNTIME_ID="linux-arm64";; aarch64) RUNTIME_ID="linux-arm";;
esac esac
fi fi
@@ -60,7 +60,7 @@ fi
# Make sure current platform support publish the dotnet runtime # Make sure current platform support publish the dotnet runtime
# Windows can publish win-x86/x64 # Windows can publish win-x86/x64
# Linux can publish linux-x64/arm/arm64/rhel.6-x64 # Linux can publish linux-x64/arm/rhel.6-x64
# OSX can publish osx-x64 # OSX can publish osx-x64
if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then
if [[ ("$RUNTIME_ID" != 'win-x86') && ("$RUNTIME_ID" != 'win-x64') ]]; then if [[ ("$RUNTIME_ID" != 'win-x86') && ("$RUNTIME_ID" != 'win-x64') ]]; then
@@ -68,7 +68,7 @@ if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then
exit 1 exit 1
fi fi
elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then
if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-arm') && ("$RUNTIME_ID" != 'linux-arm64') && ("$RUNTIME_ID" != 'rhel.6-x64') ]]; then if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-arm') && ("$RUNTIME_ID" != 'rhel.6-x64') ]]; then
echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2 echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2
exit 1 exit 1
fi fi
@@ -208,6 +208,8 @@ fi
echo "Prepend ${DOTNETSDK_INSTALLDIR} to %PATH%" echo "Prepend ${DOTNETSDK_INSTALLDIR} to %PATH%"
export PATH=${DOTNETSDK_INSTALLDIR}:$PATH export PATH=${DOTNETSDK_INSTALLDIR}:$PATH
heading "Github Dreamlifter Runner"
heading "Dotnet SDK Version" heading "Dotnet SDK Version"
dotnet --version dotnet --version

View File

@@ -1 +1 @@
2.160.0 2.160.1