Beispiel #1
0
        private static void AddEnvironments(VSTSRelease_v1 vstsRelease, VSTSReleaseDetails releaseDetails)
        {
            if (vstsRelease == null || vstsRelease.Items == null)
            {
                throw new InvalidOperationException();
            }

            foreach (var environment in releaseDetails.Environments)
            {
                var node = vstsRelease.Items.FirstOrDefault(i => i.Name == environment.Name);

                if (node == null)
                {
                    node = new VSTSReleaseEnvironment
                    {
                        Name          = environment.Name,
                        EnvironmentId = environment.Id
                    };

                    Application.Current.Dispatcher.Invoke(() => vstsRelease.Add(node));
                    if (environment.State == State.PartiallySucceeded)
                    {
                        Item guiNode = new VSTSReleaseTask()
                        {
                            Name = "Test!"
                        };
                        Application.Current.Dispatcher.Invoke(() => node.Add(guiNode));
                    }
                }

                node.State = environment.State;
            }
        }
Beispiel #2
0
 private void AddTasks(VSTSRelease_v1 vstsRelease, VSTSReleaseDetails releaseDetails)
 {
     foreach (var environment in releaseDetails.Environments.Where(e => e.State != State.Ok))
     {
         var node = vstsRelease.Items.First(i => i.Name == environment.Name);
         foreach (var deploymentAttempt in environment.DeploySteps.Where(ds => ds.State != State.Ok))
         {
             foreach (var releaseTask in deploymentAttempt.ReleaseDeployPhases.SelectMany(rdp => rdp.DeploymentJobs).SelectMany(dj => dj.Tasks).Where(t => t.State != State.Ok))
             {
                 Item task = new VSTSReleaseTask()
                 {
                     Name = releaseTask.Name, State = releaseTask.State
                 };
                 Application.Current.Dispatcher.Invoke(() => node.Add(task));
             }
         }
     }
 }