Example #1
0
        /// <summary>
        /// Print out the Mac times comparing the Mac Minis to the Powerbooks
        /// </summary>
        private static void PrintMacTimes()
        {
            var client    = CreateClient();
            var miniTimes = new List <TimeSpan>();
            var proTimes  = new List <TimeSpan>();

            foreach (var buildId in client.GetBuildIds(new JobId("roslyn_prtest_mac_dbg_unit32", JobId.Root)))
            {
                var buildInfo = client.GetBuildInfo(buildId);
                var result    = client.GetBuildResult(buildInfo);
                if (result.State != BuildState.Succeeded)
                {
                    continue;
                }

                var time = result.BuildInfo.Duration;
                var json = client.GetJson(JenkinsUtil.GetBuildPath(buildId), tree: "builtOn");
                var name = json.Value <string>("builtOn");
                if (name.Contains("macpro"))
                {
                    proTimes.Add(time);
                }
                else
                {
                    miniTimes.Add(time);
                }
            }

            Console.WriteLine($"Pro Average: {TimeSpan.FromMilliseconds(proTimes.Average(x => x.TotalMilliseconds))}");
            Console.WriteLine($"Mini Average: {TimeSpan.FromMilliseconds(miniTimes.Average(x => x.TotalMilliseconds))}");
        }
Example #2
0
        private static async Task DrainPoisonQueue()
        {
            var account   = GetStorageAccount();
            var client    = account.CreateCloudQueueClient();
            var queue     = client.GetQueueReference($"{AzureConstants.QueueNames.BuildEvent}-poison");
            var populator = new BuildTablePopulator(account.CreateCloudTableClient(), CreateClient(), Console.Out);
            var set       = new HashSet <BuildId>();

            do
            {
                var message = await queue.GetMessageAsync();

                var obj     = JObject.Parse(message.AsString);
                var jobPath = obj.Value <string>("jobName");
                var number  = obj.Value <int>("number");
                var buildId = new BuildId(number, JenkinsUtil.ConvertPathToJobId(jobPath));
                if (!set.Add(buildId))
                {
                    continue;
                }

                await populator.PopulateBuild(buildId);

                await queue.DeleteMessageAsync(message);
            } while (true);
        }
Example #3
0
        internal void AddJson(
            BuildId buildId,
            string buildInfoJson   = null,
            string buildResultJson = null,
            string failureInfoJson = null,
            string testReportJson  = null)
        {
            var buildPath = $"{JenkinsUtil.GetBuildPath(buildId)}api/json";

            if (buildInfoJson != null)
            {
                AddJsonCore(buildInfoJson, buildPath, tree: JsonUtil.BuildInfoTreeFilter);
            }

            if (buildResultJson != null)
            {
                AddJsonCore(buildResultJson, buildPath);
            }

            if (failureInfoJson != null)
            {
                AddJsonCore(failureInfoJson, buildPath, depth: 4);
            }

            if (testReportJson != null)
            {
                var testReportPath = $"{JenkinsUtil.GetBuildPath(buildId)}testReport/api/json";
                AddJsonCore(testReportJson, testReportPath);
            }
        }
Example #4
0
        private OS GetOsForBuild(BuildId buildId)
        {
            var json     = _client.GetJson(JenkinsUtil.GetBuildPath(buildId), tree: "builtOn[*]");
            var computer = json.Value <string>("builtOn");
            OS  os;

            if (!string.IsNullOrEmpty(computer) && _computerNameMap.TryGetValue(computer, out os))
            {
                return(os);
            }

            return(OS.Unknown);
        }
Example #5
0
        private static async Task TestJob()
        {
            var jobUrlStr = "http://dotnet-ci.cloudapp.net/job/Private/job/dotnet_roslyn-internal/job/microupdate/job/windows_vsi_p2/8/";
            var uri       = new Uri(jobUrlStr);
            var parts     = uri.PathAndQuery.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
            var jobPath   = string.Join("/", parts.Take(parts.Length - 1));
            var number    = int.Parse(parts.Last());
            var jobId     = JenkinsUtil.ConvertPathToJobId(jobPath);
            var buildId   = new BuildId(number, jobId);

            var account   = GetStorageAccount();
            var populator = new BuildTablePopulator(account.CreateCloudTableClient(), CreateClient(), Console.Out);
            await populator.PopulateBuild(buildId);
        }
Example #6
0
        private static void CollectData()
        {
            var all = new List <string>();

            foreach (var file in Directory.EnumerateFiles(Root, "builds.csv", SearchOption.AllDirectories))
            {
                foreach (var buildData in ReadBuildData(file))
                {
                    var path    = JenkinsUtil.ConvertJobIdToPath(buildData.BuildId.JobId);
                    var isPr    = JobUtil.IsPullRequestJobName(buildData.BuildId.JobId);
                    var newLine = $"{path},{buildData.BuildId.Number},{isPr},{buildData.ResultName},{buildData.ResultCategory}";
                    all.Add(newLine);
                }
            }

            File.WriteAllLines(
                Path.Combine(Root, "all.csv"),
                all.ToArray());
        }
Example #7
0
        public TestFailureData GetTestFailure([FromUri] string name, [FromUri] DateTimeOffset?startDate = null, string viewName = AzureUtil.ViewNameRoslyn)
        {
            var data = new TestFailureData()
            {
                Name   = name,
                Builds = new List <BuildData>()
            };

            var startDateValue = startDate ?? DateTimeOffset.UtcNow - TimeSpan.FromDays(1);
            var prCount        = 0;
            var commitCount    = 0;

            foreach (var entity in _buildUtil.GetTestCaseFailures(startDateValue, name, viewName))
            {
                var buildId = entity.BuildId;
                var jobId   = buildId.JobId;
                if (JobUtil.IsPullRequestJobName(jobId.Name))
                {
                    prCount++;
                }
                else
                {
                    commitCount++;
                }

                var buildData = new BuildData()
                {
                    JobName      = jobId.Name,
                    JobShortName = jobId.ShortName,
                    JobUri       = JenkinsUtil.GetUri(SharedConstants.DotnetJenkinsUri, jobId).ToString(),
                    MachineName  = entity.MachineName,
                    DateTime     = startDateValue,
                };

                data.Builds.Add(buildData);
            }

            data.TotalFailures       = prCount + commitCount;
            data.CommitFailures      = commitCount;
            data.PullRequestFailures = prCount;
            return(data);
        }
Example #8
0
            public void PrivateRoslyn()
            {
                var jobId = JenkinsUtil.ConvertPathToJobId("job/Private/job/dotnet_roslyn-internal/job/master/job/windows_debug_eta/");

                Assert.Equal("dotnet_roslyn", AzureUtil.GetViewName(jobId));
            }
Example #9
0
            public void Private()
            {
                var jobId = JenkinsUtil.ConvertPathToJobId("job/Private/job/dotnet_debuggertests/job/master/job/linux_dbg/");

                Assert.Equal("dotnet_debuggertests", AzureUtil.GetViewName(jobId));
            }
Example #10
0
 private string GetApiPath(BuildId buildId)
 {
     return($"{JenkinsUtil.GetBuildPath(buildId)}api/json");
 }
 private static void Test(string path, JobId id)
 {
     Assert.Equal(path, JenkinsUtil.ConvertJobIdToPath(id));
     Assert.Equal(id, JenkinsUtil.ConvertPathToJobId(path));
 }
            public void ConvertTimestamp()
            {
                var dateTimeOffset = JenkinsUtil.ConvertTimestampToDateTimeOffset(1462922992229);

                Assert.Equal(635985197922290000, dateTimeOffset.UtcTicks);
            }
 public void GetBuildPath()
 {
     Assert.Equal("job/test/2/", JenkinsUtil.GetBuildPath(new BuildId(2, JobId.ParseName("test"))));
     Assert.Equal("job/test/job/op/13/", JenkinsUtil.GetBuildPath(new BuildId(13, JobId.ParseName("test/op"))));
 }
 public void GetJobPath()
 {
     Assert.Equal("job/test", JenkinsUtil.GetJobPath(JobId.ParseName("test")));
     Assert.Equal("job/test/job/op", JenkinsUtil.GetJobPath(JobId.ParseName("test/op")));
 }
 private static void Test(string path, BuildId buildId)
 {
     Assert.Equal(buildId, JenkinsUtil.ConvertPathToBuildId(path));
 }