Ejemplo n.º 1
0
        /// <summary>
        /// Executes a project job, notifying the callback path when complete.
        /// </summary>
        public async Task ExecuteProjectJobAsync(ProjectJob projectJob, string operationId)
        {
            using (_logger.BeginScope(
                       new Dictionary <string, object>()
            {
                ["OperationId"] = operationId,
                ["GitHubOrg"] = projectJob.GitHubOrg,
                ["GitHubRepo"] = projectJob.SubmissionRepo,
                ["CommitSha"] = projectJob.CommitSha
            }))
            {
                _logger.LogInformation("Starting project job.");

                var result = await RunJobAsync(projectJob, operationId);

                _logger.LogInformation(
                    "Project job completed with {status} status and {numTestResults} test results.",
                    result.Status.ToString() ?? "Unknown",
                    result.TestResults?.Count ?? 0);

                await _notifier.NotifyAsync
                (
                    _config.ProjectJobResultHost,
                    projectJob.CallbackPath,
                    operationId,
                    result
                );

                _logger.LogInformation("Sent notification for job completion.");
            }
        }