Example #1
0
        private static async Task TestFailureYesterday(int days = -1)
        {
            var account     = GetStorageAccount();
            var tableClient = account.CreateCloudTableClient();
            var table       = tableClient.GetTableReference(TableNames.BuildState);
            var date        = DateTimeOffset.UtcNow.AddDays(days);
            var query       = TableQueryUtil.And(
                TableQueryUtil.PartitionKey(DateTimeKey.GetDateKey(date)),
                TableQueryUtil.Column(nameof(BuildStateEntity.IsBuildFinished), true),
                TableQueryUtil.Column(nameof(BuildStateEntity.IsDataComplete), false));
            var list = await AzureUtil.QueryAsync <BuildStateEntity>(table, query);

            foreach (var entity in list)
            {
                var populator = new BuildTablePopulator(tableClient, CounterUtilFactory, CreateClient(entity.BoundBuildId), TextWriter.Null);
                try
                {
                    Console.Write($"{entity.BuildId} ... ");
                    await populator.PopulateBuild(entity.BoundBuildId);

                    Console.WriteLine("good");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("ERRROR");
                    Console.WriteLine(ex);
                }
            }
        }
Example #2
0
        public async Task <ActionResult> Status(bool all = false, bool error = false, DateTimeOffset?startDate = null)
        {
            var startDateValue = startDate ?? DateTimeOffset.UtcNow;
            var key            = BuildStateEntity.GetPartitionKey(startDateValue);
            var table          = _storageAccount.CreateCloudTableClient().GetTableReference(AzureConstants.TableNames.BuildState);
            var filter         = TableQueryUtil.Column(nameof(TableEntity.PartitionKey), key, ColumnOperator.GreaterThanOrEqual);

            if (error)
            {
                filter = TableQueryUtil.And(
                    filter,
                    TableQueryUtil.Column(nameof(BuildStateEntity.Error), (string)null, ColumnOperator.NotEqual));
            }
            else if (!all)
            {
                filter = TableQueryUtil.And(
                    filter,
                    TableQueryUtil.Column(nameof(BuildStateEntity.IsDataComplete), false));
            }
            var list = await AzureUtil.QueryAsync <BuildStateEntity>(table, filter);

            var model = new BuildStatusModel(all, error, startDateValue, list);

            return(View(viewName: "Status", model: model));
        }
Example #3
0
        private static async Task Random()
        {
            /*
             * var boundBuildId = BoundBuildId.Parse("https://dotnet-ci.cloudapp.net/job/dotnet_corefx/job/master/job/fedora23_debug_tst/134/");
             * var buildId = boundBuildId.BuildId;
             * var client = CreateClient(uri: boundBuildId.HostUri, auth: true);
             * var buildInfo = await client.GetBuildInfoAsync(buildId);
             * var buildResult = await client.GetBuildResultAsync(buildInfo);
             * var test = await client.GetFailedTestCasesAsync(buildId);
             * var prInfo = await client.GetPullRequestInfoAsync(buildId);
             */

            var testboundBuildId = BoundBuildId.Parse("https://dotnet-ci.cloudapp.net/job/dotnet_coreclr/job/release_1.0.0/job/x64_release_rhel7.2_pri1_flow/30/");
            var testbuildId      = testboundBuildId.BuildId;
            var client           = CreateClient(testboundBuildId);
            var elapsedTimeObj   = client.GetBuildInfo(testbuildId).Duration;

            Console.WriteLine($"\tET: {elapsedTimeObj.TotalMilliseconds}");

            var account = GetStorageAccount();
            var dateKey = new DateKey(DateTimeOffset.UtcNow - TimeSpan.FromDays(1));
            var table   = account.CreateCloudTableClient().GetTableReference(AzureConstants.TableNames.BuildResultDate);
            var query   = TableQueryUtil.And(
                TableQueryUtil.Column(ColumnName.PartitionKey, dateKey.Key, ColumnOperator.GreaterThanOrEqual),
                TableQueryUtil.Column("MachineName", "Azure0602081822"));
            var all = await AzureUtil.QueryAsync <BuildResultEntity>(table, query);

            foreach (var entity in all)
            {
                Console.WriteLine(entity.BoundBuildId.BuildUri);
            }
        }
Example #4
0
        private static async Task MigrateDateKeyCore <T>(string tableName)
            where T : ITableEntity, new()
        {
            Console.WriteLine($"Processing {tableName}");

            var account = GetStorageAccount();
            var table   = account.CreateCloudTableClient().GetTableReference(tableName);

            var startKey = new DateKey(DateKey.StartDate);
            var endKey   = new DateKey(DateTimeOffset.UtcNow);
            var query    = TableQueryUtil.And(
                TableQueryUtil.PartitionKey(startKey.Key, ColumnOperator.GreaterThanOrEqual),
                TableQueryUtil.PartitionKey(endKey.Key, ColumnOperator.LessThanOrEqual));
            var list = await AzureUtil.QueryAsync <T>(table, query);

            Console.WriteLine($"Processing {list.Count} entities");
            var deleteList = new List <EntityKey>();

            foreach (var entity in list)
            {
                deleteList.Add(entity.GetEntityKey());

                var dateKey     = DateKey.Parse(entity.PartitionKey);
                var dateTimeKey = new DateTimeKey(dateKey.Date, DateTimeKeyFlags.Date);
                entity.PartitionKey = dateTimeKey.Key;
            }

            Console.WriteLine("Writing new values");
            await AzureUtil.InsertBatchUnordered(table, list);

            Console.WriteLine("Deleting old values");
            await AzureUtil.DeleteBatchUnordered(table, deleteList);
        }
Example #5
0
        public List <BuildFailureEntity> GetTestCaseFailures(DateTimeOffset startDate, string name, string viewName)
        {
            var filter = TableQueryUtil.And(
                FilterSinceDate(startDate),
                TableQueryUtil.Column(nameof(BuildFailureEntity.Identifier), name));

            filter = FilterView(filter, viewName);
            var query = new TableQuery <BuildFailureEntity>().Where(filter);

            return(_buildFailureDateTable.ExecuteQuery(query).ToList());
        }
Example #6
0
        public List <BuildResultEntity> GetBuildResultsByKindName(DateTimeOffset startDate, string kindName, string viewName)
        {
            var filter = TableQueryUtil.And(
                FilterSinceDate(startDate),
                TableQueryUtil.Column(nameof(BuildResultEntity.ClassificationName), kindName));

            filter = FilterView(filter, viewName);
            var query = new TableQuery <BuildResultEntity>().Where(filter);

            return(_buildResultDateTable.ExecuteQuery(query).ToList());
        }
Example #7
0
        private static string FilterView(string query, string viewName)
        {
            Debug.Assert(nameof(BuildResultEntity.ViewName) == nameof(BuildFailureEntity.ViewName));

            if (viewName == AzureUtil.ViewNameAll)
            {
                return(query);
            }

            return(TableQueryUtil.And(
                       query,
                       TableQueryUtil.Column(nameof(BuildResultEntity.ViewName), viewName, ColumnOperator.Equal)));
        }