public void RunDeployTask(IAgentDeployContext context, RemoteTaskCompletionSource completeEvent) { if (deployTaskRegistry.TryGetDescription(context.TaskName, out var taskDesc)) { if (taskDesc.Roles?.Any() ?? false) { var isInRole = context.Agent?.Roles?.ContainsAny(taskDesc.Roles, StringComparer.OrdinalIgnoreCase) ?? false; if (!isInRole) { // Task is not in agent roles completeEvent.SetResult(); return; } } } using (var block = context.Output.WriteBlock()) { block.Write("Running deployment task ", ConsoleColor.DarkCyan); block.Write(context.TaskName, ConsoleColor.Cyan); block.Write(" on agent ", ConsoleColor.DarkCyan); block.Write(context.Agent?.Name, ConsoleColor.Cyan); block.WriteLine("...", ConsoleColor.DarkCyan); } deployTaskRegistry.ExecuteTask(context, CancellationToken.None) .ContinueWith(completeEvent.FromTask); }
public void RunDeployTask(IAgentDeployContext context, RemoteTaskCompletionSource <object> completeEvent) { Task.Run(async() => { await deployTaskRegistry.ExecuteTask(context, CancellationToken.None); return((object)null); }).ContinueWith(completeEvent.FromTask); }
public void RunDeployTask(IAgentDeployContext context, RemoteTaskCompletionSource completeEvent) { using (var block = context.Output.WriteBlock()) { block.Write("Running deployment task ", ConsoleColor.DarkCyan); block.Write(context.TaskName, ConsoleColor.Cyan); block.Write(" on agent ", ConsoleColor.DarkCyan); block.Write(context.Agent?.Name, ConsoleColor.Cyan); block.WriteLine("...", ConsoleColor.DarkCyan); } deployTaskRegistry.ExecuteTask(context, CancellationToken.None) .ContinueWith(completeEvent.FromTask); }