Example #1
0
        public VstsReleaseDefinitions GetDetailedReleaseDefinitions(string project)
        {
            VstsReleaseDefinitions items;

            try
            {
                items = GetReleaseDefitions(project);
                var config = new Configuration(ORG_V, TOKEN);

                for (int i = 0; i < items.ReleaseDefinitions.Count; i++)
                //                Parallel.For(0, items.ReleaseDefinitions.Count, new ParallelOptions { MaxDegreeOfParallelism = 2 }, i =>
                {
                    config.UriString = items.ReleaseDefinitions[i].Url;
                    var rest = new VstsRest(config);
                    items.ReleaseDefinitions[i] = rest.GetItem <VstsReleaseDefinition>();

                    System.Diagnostics.Debug.WriteLine($"--Release -- {config.UriString} ------------------------------");
                }
//                );
                System.Diagnostics.Debug.WriteLine("DONE WITH RELEASES ------------------------------");
            }
            catch (System.Exception ex)
            {
                var asd = ex.Message;
                items = new VstsReleaseDefinitions()
                {
                    ReleaseDefinitions = new List <VstsReleaseDefinition>()
                };
                System.Diagnostics.Debug.WriteLine($"EMPTY RELEASES ----[{ex.Message}]--------------------------");
            }

            return(items);
        }
Example #2
0
        public VstsBuildDefinitions GetDetiledBuildDefinitions(string project)
        {
            VstsBuildDefinitions items;

            try
            {
                items = GetBuildDefinitions(project);

                // Now one at a time, go through each and fill out the remaining information
                var config = new Configuration(ORG, TOKEN);

                for (int i = 0; i < items.BuildDefinitions.Count; i++)
                //                Parallel.For(0, items.BuildDefinitions.Count, new ParallelOptions { MaxDegreeOfParallelism = 2 }, i =>
                {
                    var temp = items.BuildDefinitions[i];
                    //config.UriString = items.BuildDefinitions[i].Url;
                    config.UriString = $"https://mrcooper.visualstudio.com/Originations/_apis/build/definitions/{temp.Id}?api-version=2.0";
                    var rest = new VstsRest(config);

                    //System.Threading.Thread.Sleep(500);
                    System.Diagnostics.Debug.WriteLine($"--Builds -- [{i}]-[{items.BuildDefinitions.Count}]--- {config.UriString} ------------------------------");

                    items.BuildDefinitions[i] = rest.GetItem <VstsBuildDefinition>();
                }
                System.Diagnostics.Debug.WriteLine("DONE WITH BUILDS ------------------------------");
                //                );
            }
            catch (System.Exception ee)
            {
                var asd = ee.Message;
                items = new VstsBuildDefinitions()
                {
                    BuildDefinitions = new List <VstsBuildDefinition>()
                };
                System.Diagnostics.Debug.WriteLine($"EMPTY builds ----[{ee.Message}]--------------------------");
            }


            return(items);
        }