Ejemplo n.º 1
0
        internal async Task PrintBuildResults(IEnumerable <string> args)
        {
            int count     = 5;
            var optionSet = new OptionSet()
            {
                { "c|count=", "count of builds to return", (int c) => count = c }
            };

            ParseAll(optionSet, args);

            var data = DotNetUtil.BuildDefinitions
                       .AsParallel()
                       .AsOrdered()
                       .Select(async t => (t.BuildName, t.DefinitionId, await QueryUtil.ListBuildsAsync(count, t.Project, new[] { t.DefinitionId })));

            foreach (var task in data)
            {
                var(name, definitionId, builds) = await task;
                Console.Write($"{name,-20}");
                var percent = (builds.Count(x => x.Result == BuildResult.Succeeded) / (double)count) * 100;
                Console.Write($"{percent,4:G3}%  ");
                foreach (var build in builds)
                {
                    var c = build.Result == BuildResult.Succeeded ? 'Y' : 'N';
                    Console.Write(c);
                }

                Console.WriteLine();
            }
        }
Ejemplo n.º 2
0
 public async Task Triage(string buildQuery)
 {
     foreach (var build in await QueryUtil.ListBuildsAsync(buildQuery))
     {
         await Triage(build).ConfigureAwait(false);
     }
 }
Ejemplo n.º 3
0
        internal async Task <int> PrintSearchHelix(IEnumerable <string> args)
        {
            string?text      = null;
            bool   markdown  = false;
            var    optionSet = new BuildSearchOptionSet()
            {
                { "v|value=", "text to search for", t => text = t },
                { "m|markdown", "print output in markdown", m => markdown = m is object },
            };

            ParseAll(optionSet, args);

            if (text is null)
            {
                Console.WriteLine("Must provide a text argument to search for");
                optionSet.WriteOptionDescriptions(Console.Out);
                return(ExitFailure);
            }

            var textRegex  = new Regex(text, RegexOptions.Compiled | RegexOptions.IgnoreCase);
            var collection = await QueryUtil.ListBuildsAsync(optionSet);

            var foundRaw = collection
                           .AsParallel()
                           .Select(async b => await SearchBuild(DevOpsServer, QueryUtil, textRegex, b));
            var found = await RuntimeInfoUtil.ToListAsync(foundRaw);

            var badLogBuilder = new StringBuilder();

            found.ForEach(x => x.BadLogs.ForEach(l => badLogBuilder.AppendLine(l)));
            Console.WriteLine(ReportBuilder.BuildSearchHelix(
                                  found
                                  .Select(x => (x.Build.GetBuildInfo(), x.LogInfo))
                                  .Where(x => x.LogInfo is object),
                                  new[] { HelixLogKind.Console, HelixLogKind.CoreDump },
                                  markdown: markdown,
                                  badLogBuilder.ToString()));

            return(ExitSuccess);