public async Task ExecuteScript(IServerDeployContext context, CancellationToken token) { if (!map.TryGetValue(context.ScriptName, out var scriptClassType)) { throw new Exception($"Deploy Script '{context.ScriptName}' was not found!"); } object classObject = null; try { classObject = Activator.CreateInstance(scriptClassType); if (!(classObject is IDeployScript script)) { throw new Exception($"Invalid IDeployScript implementation '{scriptClassType}'!"); } script.Context = context; await script.RunAsync(token); } finally { (classObject as IDisposable)?.Dispose(); } }
public async Task RunDeployScript(IServerDeployContext context, CancellationToken token) { var completeEvent = new RemoteTaskCompletionSource(token); Agent.RunDeployScript(context, completeEvent); await completeEvent.Task; }
public AgentDeploySessionHandle(IServerDeployContext context, ServerAgentDefinition agentDefinition, MessageProcessorRegistry registry) { this.context = context; this.definition = agentDefinition; Tasks = new TaskRunnerManager(); messageClient = new MessageClient(registry) { Context = context, }; messageClient.ThreadException += MessageClient_OnThreadException; }
public void RunDeployScript(IServerDeployContext context, RemoteTaskCompletionSource completeEvent) { deployScriptRegistry.ExecuteScript(context, CancellationToken.None) .ContinueWith(completeEvent.FromTask); }
public async Task RunAsync(IServerDeployContext context) { var agents = context.RegisterAgents.Environment(context.EnvironmentName); //... }