public async Async.Task NewFiles(Container container, string filename, bool failTaskOnTransientError)
    {
        var notifications    = GetNotifications(container);
        var hasNotifications = await notifications.AnyAsync();

        var report = await _context.Reports.GetReportOrRegression(container, filename, expectReports : hasNotifications);

        if (!hasNotifications)
        {
            return;
        }

        var done = new List <NotificationTemplate>();

        await foreach (var notification in notifications)
        {
            if (done.Contains(notification.Config))
            {
                continue;
            }

            done.Add(notification.Config);

            if (notification.Config.TeamsTemplate != null)
            {
                NotifyTeams(notification.Config.TeamsTemplate, container, filename, report);
            }

            if (report == null)
            {
                continue;
            }

            if (notification.Config.AdoTemplate != null)
            {
                NotifyAdo(notification.Config.AdoTemplate, container, filename, report, failTaskOnTransientError);
            }

            if (notification.Config.GithubIssuesTemplate != null)
            {
                GithubIssue(notification.Config.GithubIssuesTemplate, container, filename, report);
            }
        }

        await foreach (var(task, containers) in GetQueueTasks())
        {
            if (containers.Contains(container.ContainerName))
            {
                _logTracer.Info($"queuing input {container.ContainerName} {filename} {task.TaskId}");
                var url = _context.Containers.GetFileSasUrl(container, filename, StorageType.Corpus, BlobSasPermissions.Read | BlobSasPermissions.Delete);
                await _context.Queue.SendMessage(task.TaskId.ToString(), url?.ToString() ?? "", StorageType.Corpus);
            }
        }

        if (report?.Report != null)
        {
            var reportTask = await _context.TaskOperations.GetByJobIdAndTaskId(report.Report.JobId, report.Report.TaskId);

            var crashReportedEvent = new EventCrashReported(report.Report, container, filename, reportTask?.Config);
            await _context.Events.SendEvent(crashReportedEvent);
        }
        else if (report?.RegressionReport != null)
        {
            var reportTask = await GetRegressionReportTask(report.RegressionReport);

            var regressionEvent = new EventRegressionReported(report.RegressionReport, container, filename, reportTask?.Config);
            await _context.Events.SendEvent(regressionEvent);
        }
        else
        {
            await _context.Events.SendEvent(new EventFileAdded(container, filename));
        }
    }
示例#2
0
 public bool EventRegressionReported(EventRegressionReported e)
 {
     return(Test(e));
 }