Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        public async Task RunDeployScript(IServerDeployContext context, CancellationToken token)
        {
            var completeEvent = new RemoteTaskCompletionSource(token);

            Agent.RunDeployScript(context, completeEvent);
            await completeEvent.Task;
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
 public void RunDeployScript(IServerDeployContext context, RemoteTaskCompletionSource completeEvent)
 {
     deployScriptRegistry.ExecuteScript(context, CancellationToken.None)
     .ContinueWith(completeEvent.FromTask);
 }
Exemplo n.º 5
0
        public async Task RunAsync(IServerDeployContext context)
        {
            var agents = context.RegisterAgents.Environment(context.EnvironmentName);

            //...
        }