Пример #1
0
        public async Task TriggerBuilds()
        {
            var buildOrderList = _fileBuildOrderLogic.OpenFile();

            var buildList = await _azureDevOps.GetBuilds();

            var updatedBuildList = await _azureDevOps.TriggerBuilds(buildOrderList, buildList);

            buildOrderList = updatedBuildList.Select(x => new BuildOrderDto {
                Name = x.name, Order = x.BuildSuccessOrder
            }).ToList();

            _fileBuildOrderLogic.CreateOrModifyFile(buildOrderList);
        }
Пример #2
0
        /// <summary>
        /// Let's play ping pong!
        /// </summary>
        /// <returns></returns>
        public async Task <int> PingPong()
        {
            int result = -1;

            try
            {
                Console.WriteLine("PingPong Starting");

                var buildOrderList = _fileBuildOrderLogic.OpenFile();

                var buildList = await GetBuilds();

                if (buildList == null || !buildList.Any())
                {
                    Console.WriteLine($"No builds were found.");
                    return(result);
                }

                Console.WriteLine($"Builds found: {buildList.Select(x => x.name).Aggregate((x, i) => x + Environment.NewLine +i)}");

                var updatedBuildList = await TriggerBuilds(buildOrderList, buildList);

                buildOrderList = updatedBuildList.Select(x => new BuildOrderDto {
                    Name = x.name, Order = x.BuildSuccessOrder
                }).ToList();

                Console.WriteLine($"Build order: {buildOrderList.Select(x => x.Name).Aggregate((x, i) => x + Environment.NewLine + i)}");


                _fileBuildOrderLogic.CreateOrModifyFile(buildOrderList);

                result = 0;
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: { ex.ToString() }");
            }

            Console.WriteLine("PingPong Ended");

            return(result);
        }