Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Include AssignedTo when failing to create a work item due to an authentication exception #2770

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public interface INotificationOperations : IOrm<Notification> {
IAsyncEnumerable<Notification> GetNotifications(Container container);
IAsyncEnumerable<(Task, IEnumerable<Container>)> GetQueueTasks();
Async.Task<OneFuzzResult<Notification>> Create(Container container, NotificationTemplate config, bool replaceExisting);
Async.Task<Notification> GetNotification(Guid notifificationId);
}

public class NotificationOperations : Orm<Notification>, INotificationOperations {
Expand Down Expand Up @@ -142,4 +143,8 @@ private async Async.Task<NotificationTemplate> HideSecrets(NotificationTemplate
_logTracer.Error($"unable to find crash_report or no repro entry for report: {JsonSerializer.Serialize(report)}");
return null;
}

public async Async.Task<Notification> GetNotification(Guid notifificationId) {
tevoinea marked this conversation as resolved.
Show resolved Hide resolved
return await SearchByPartitionKeys(new[] { notifificationId.ToString() }).SingleAsync();
}
}
5 changes: 5 additions & 0 deletions src/ApiService/ApiService/onefuzzlib/notifications/Ado.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public async Async.Task NotifyAdo(AdoTemplate config, Container container, strin
await ado.Process(notificationInfo);
} catch (Exception e)
when (e is VssAuthenticationException || e is VssServiceException) {
var _ = config.AdoFields.TryGetValue("System.AssignedTo", out var assignedTo);
if (e is VssAuthenticationException && !string.IsNullOrEmpty(assignedTo)) {
notificationInfo = notificationInfo.AddRange(new (string, string)[] { ("assigned_to", assignedTo) });
}

if (!isLastRetryAttempt && IsTransient(e)) {
_logTracer.WithTags(notificationInfo).Error($"transient ADO notification failure {report.JobId:Tag:JobId} {report.TaskId:Tag:TaskId} {container:Tag:Container} {filename:Tag:Filename}");
throw;
Expand Down