コード例 #1
0
        public void ExecuteEnvironmentDeployment()
        {
            IsLoadingData = true;
            Task.Factory.StartNew(() =>
            {
                try
                {
                    var deployers = new IComponentVertexDeployer[]
                    {
                        new OctopusComponentVertexVariableUpdater(_octopusUrl, _octopusApiKey),
                        new OctopusComponentVertexDeployer(_octopusUrl, _octopusApiKey, EnvironmentToDeployTo),
                    };

                    CancellationTokenSource    = new CancellationTokenSource();
                    var deploymentExecutor     = new DeploymentExecutor(deployers, EnvironmentDeployment, CancellationTokenSource.Token, new OctopusLogMessages(_octopusUrl), this, MaximumParallelDeployment);
                    var allDeploymentsSucceded = deploymentExecutor.Execute().ConfigureAwait(false).GetAwaiter().GetResult();

                    SkipAllPassedDeployments();
                }
                catch
                {
                }
            }).ContinueWith(task =>
            {
                CancellationTokenSource = null;
                IsLoadingData           = false;
            });
        }
コード例 #2
0
        private static int Deploy(INotifier notificaiton, ILogMessages logMessages, EnvironmentDeployment environmentDeployment, int maximumParalleDeployments, IEnumerable <IComponentVertexDeployer> deployers)
        {
            var cancellationTokenSource = new CancellationTokenSource();
            var deploymentExecutor      = new DeploymentExecutor(deployers, environmentDeployment, cancellationTokenSource.Token, logMessages, notificaiton, maximumParalleDeployments);
            var allDeploymentsSucceded  = deploymentExecutor.Execute().ConfigureAwait(false).GetAwaiter().GetResult();

            return(allDeploymentsSucceded ? 0 : 1);
        }