Information about a deployment.
 private string DescribeFailedDeployment(DeploymentInfo deploymentInfo)
 {
     return string.Format("{0} ({1})\n{2}", deploymentInfo.DeploymentGroupName, deploymentInfo.DeploymentId, DescribeFailedInstances(deploymentInfo.DeploymentId));
 }
Exemple #2
0
        private FailedInstance[] GetFailedInstancesFor(DeploymentInfo[] failedDeployments)
        {
            var allFailedInstances = new List<FailedInstance>();
            foreach (var deployment in failedDeployments)
            {
                var instancesResult = _codeDeployClient.ListDeploymentInstances(new ListDeploymentInstancesRequest
                {
                    DeploymentId = deployment.DeploymentId,
                    InstanceStatusFilter = new List<string> { "Failed" }
                });

                var tmpDeployment = deployment;
                var awsInstances = instancesResult.InstancesList.Select(id =>
                        _codeDeployClient.GetDeploymentInstance(new GetDeploymentInstanceRequest
                        {
                            InstanceId = id,
                            DeploymentId = tmpDeployment.DeploymentId
                        }));

                allFailedInstances.AddRange(awsInstances.Select(i => {
                    var firstFailEvent = i.InstanceSummary.LifecycleEvents.FirstOrDefault(lce => lce.Status == LifecycleEventStatus.Failed);
                    var tail = firstFailEvent == null ? string.Empty : firstFailEvent.Diagnostics.LogTail;
                    return new FailedInstance(i.InstanceSummary.InstanceId, deployment.DeploymentId, tail);
                }));
            }

            return allFailedInstances.ToArray();
        }
 public DeploymentsFailedException(DeploymentInfo[] failedDeployments, FailedInstance[] failedInstances)
 {
     _failedDeployments = failedDeployments;
     _failedInstances = failedInstances;
 }