Skip to content

Commit

Permalink
Merge branch 'master' into 150-runner-arch
Browse files Browse the repository at this point in the history
Conflicts:
releaseNote.md
src/runnerversion
  • Loading branch information
David Kale committed Nov 12, 2019
2 parents c0e866f + 9ba9715 commit 3ade842
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 45 deletions.
4 changes: 2 additions & 2 deletions docs/start/envosx.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Supported Versions

- macOS Sierra (10.12) and later versions
- macOS High Sierra (10.13) and later versions


## [More .Net Core Prerequisites Information](https://docs.microsoft.com/en-us/dotnet/core/macos-prerequisites?tabs=netcore2x)
## [More .Net Core Prerequisites Information](https://docs.microsoft.com/en-us/dotnet/core/macos-prerequisites?tabs=netcore30)
4 changes: 2 additions & 2 deletions docs/start/envwin.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
- Windows 7 64-bit
- Windows 8.1 64-bit
- Windows 10 64-bit
- Windows Server 2008 R2 SP1 64-bit
- Windows Server 2012 R2 64-bit
- Windows Server 2016 64-bit
- Windows Server 2019 64-bit

## [More .Net Core Prerequisites Information](https://docs.microsoft.com/en-us/dotnet/core/windows-prerequisites?tabs=netcore2x)
## [More .Net Core Prerequisites Information](https://docs.microsoft.com/en-us/dotnet/core/windows-prerequisites?tabs=netcore30)
Binary file removed src/Runner.Service/Windows/FinalPublicKey.snk
Binary file not shown.
6 changes: 2 additions & 4 deletions src/Runner.Service/Windows/RunnerService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RunnerService</RootNamespace>
<AssemblyName>RunnerService</AssemblyName>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>FinalPublicKey.snk</AssemblyOriginatorKeyFile>
<DelaySign>true</DelaySign>
<SignAssembly>false</SignAssembly>
<DelaySign>false</DelaySign>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
Expand Down Expand Up @@ -64,7 +63,6 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="FinalPublicKey.snk" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resource.resx">
Expand Down
46 changes: 26 additions & 20 deletions src/Runner.Worker/ActionCommandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public bool TryProcessCommand(IExecutionContext context, string input)
return false;
}

// process action command in serialize oreder.
// process action command in serialize order.
lock (_commandSerializeLock)
{
if (_stopProcessCommand)
Expand Down Expand Up @@ -107,32 +107,19 @@ public bool TryProcessCommand(IExecutionContext context, string input)
}
else if (_commandExtensions.TryGetValue(actionCommand.Command, out IActionCommandExtension extension))
{
bool commandHasBeenOutput = false;
if (context.EchoOnActionCommand && !extension.OmitEcho)
{
context.Output(input);
}

try
{
if (context.EchoOnActionCommand)
{
context.Output(input);
context.Debug($"Processing command '{actionCommand.Command}'");
commandHasBeenOutput = true;
}

extension.ProcessCommand(context, input, actionCommand);

if (context.EchoOnActionCommand)
{
context.Debug($"Processed command '{actionCommand.Command}' successfully");
}
}
catch (Exception ex)
{
if (!commandHasBeenOutput)
{
context.Output(input);
}

context.Error($"Unable to process command '{input}' successfully.");
var commandInformation = extension.OmitEcho ? extension.Command : input;
context.Error($"Unable to process command '{commandInformation}' successfully.");
context.Error(ex);
context.CommandResult = TaskResult.Failed;
}
Expand All @@ -151,13 +138,15 @@ public bool TryProcessCommand(IExecutionContext context, string input)
public interface IActionCommandExtension : IExtension
{
string Command { get; }
bool OmitEcho { get; }

void ProcessCommand(IExecutionContext context, string line, ActionCommand command);
}

public sealed class InternalPluginSetRepoPathCommandExtension : RunnerService, IActionCommandExtension
{
public string Command => "internal-set-repo-path";
public bool OmitEcho => false;

public Type ExtensionType => typeof(IActionCommandExtension);

Expand Down Expand Up @@ -187,6 +176,7 @@ private static class SetRepoPathCommandProperties
public sealed class SetEnvCommandExtension : RunnerService, IActionCommandExtension
{
public string Command => "set-env";
public bool OmitEcho => false;

public Type ExtensionType => typeof(IActionCommandExtension);

Expand All @@ -211,6 +201,7 @@ private static class SetEnvCommandProperties
public sealed class SetOutputCommandExtension : RunnerService, IActionCommandExtension
{
public string Command => "set-output";
public bool OmitEcho => false;

public Type ExtensionType => typeof(IActionCommandExtension);

Expand All @@ -234,6 +225,7 @@ private static class SetOutputCommandProperties
public sealed class SaveStateCommandExtension : RunnerService, IActionCommandExtension
{
public string Command => "save-state";
public bool OmitEcho => false;

public Type ExtensionType => typeof(IActionCommandExtension);

Expand All @@ -257,6 +249,7 @@ private static class SaveStateCommandProperties
public sealed class AddMaskCommandExtension : RunnerService, IActionCommandExtension
{
public string Command => "add-mask";
public bool OmitEcho => true;

public Type ExtensionType => typeof(IActionCommandExtension);

Expand All @@ -268,6 +261,11 @@ public void ProcessCommand(IExecutionContext context, string line, ActionCommand
}
else
{
if (context.EchoOnActionCommand)
{
context.Output($"::{Command}::***");
}

HostContext.SecretMasker.AddValue(command.Data);
Trace.Info($"Add new secret mask with length of {command.Data.Length}");
}
Expand All @@ -277,6 +275,7 @@ public void ProcessCommand(IExecutionContext context, string line, ActionCommand
public sealed class AddPathCommandExtension : RunnerService, IActionCommandExtension
{
public string Command => "add-path";
public bool OmitEcho => false;

public Type ExtensionType => typeof(IActionCommandExtension);

Expand All @@ -291,6 +290,7 @@ public void ProcessCommand(IExecutionContext context, string line, ActionCommand
public sealed class AddMatcherCommandExtension : RunnerService, IActionCommandExtension
{
public string Command => "add-matcher";
public bool OmitEcho => false;

public Type ExtensionType => typeof(IActionCommandExtension);

Expand Down Expand Up @@ -337,6 +337,7 @@ public void ProcessCommand(IExecutionContext context, string line, ActionCommand
public sealed class RemoveMatcherCommandExtension : RunnerService, IActionCommandExtension
{
public string Command => "remove-matcher";
public bool OmitEcho => false;

public Type ExtensionType => typeof(IActionCommandExtension);

Expand Down Expand Up @@ -404,6 +405,7 @@ private static class RemoveMatcherCommandProperties
public sealed class DebugCommandExtension : RunnerService, IActionCommandExtension
{
public string Command => "debug";
public bool OmitEcho => true;

public Type ExtensionType => typeof(IActionCommandExtension);

Expand Down Expand Up @@ -431,6 +433,7 @@ public abstract class IssueCommandExtension : RunnerService, IActionCommandExten
{
public abstract IssueType Type { get; }
public abstract string Command { get; }
public bool OmitEcho => true;

public Type ExtensionType => typeof(IActionCommandExtension);

Expand Down Expand Up @@ -510,6 +513,8 @@ public sealed class EndGroupCommandExtension : GroupingCommandExtension
public abstract class GroupingCommandExtension : RunnerService, IActionCommandExtension
{
public abstract string Command { get; }
public bool OmitEcho => false;

public Type ExtensionType => typeof(IActionCommandExtension);

public void ProcessCommand(IExecutionContext context, string line, ActionCommand command)
Expand All @@ -522,6 +527,7 @@ public void ProcessCommand(IExecutionContext context, string line, ActionCommand
public sealed class EchoCommandExtension : RunnerService, IActionCommandExtension
{
public string Command => "echo";
public bool OmitEcho => false;

public Type ExtensionType => typeof(IActionCommandExtension);

Expand Down
14 changes: 8 additions & 6 deletions src/Runner.Worker/Handlers/OutputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,17 @@ private DTWebApi.Issue ConvertToIssue(IssueMatch match)
// Root using fromPath
if (!string.IsNullOrWhiteSpace(match.FromPath) && !Path.IsPathRooted(file))
{
file = Path.Combine(match.FromPath, file);
var fromDirectory = Path.GetDirectoryName(match.FromPath);
if (!string.IsNullOrWhiteSpace(fromDirectory))
{
file = Path.Combine(fromDirectory, file);
}
}

// Root using system.defaultWorkingDirectory
// Root using workspace
if (!Path.IsPathRooted(file))
{
var githubContext = _executionContext.ExpressionValues["github"] as GitHubContext;
ArgUtil.NotNull(githubContext, nameof(githubContext));
var workspace = githubContext["workspace"].ToString();
var workspace = _executionContext.GetGitHubContext("workspace");
ArgUtil.NotNullOrEmpty(workspace, "workspace");

file = Path.Combine(workspace, file);
Expand All @@ -297,7 +299,7 @@ private DTWebApi.Issue ConvertToIssue(IssueMatch match)
}
else
{
// prefer `/` on all platforms
// Prefer `/` on all platforms
issue.Data["file"] = file.Substring(repositoryPath.Length).TrimStart(Path.DirectorySeparatorChar).Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
}
}
Expand Down
Loading

0 comments on commit 3ade842

Please sign in to comment.