예제 #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();
            }
        }
예제 #2
0
        public async Task RunDeployScript(IServerDeployContext context, CancellationToken token)
        {
            var completeEvent = new RemoteTaskCompletionSource(token);

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

            //...
        }