Skip to content

Commit b988ae2

Browse files
Merge pull request #278 from microsoft/main
Fork Sync: Update from parent repository
2 parents 5601c00 + 0ae81b2 commit b988ae2

File tree

33 files changed

+301
-153
lines changed

33 files changed

+301
-153
lines changed

.github/codeql/codeql-config.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
paths:
2-
- src/cli
2+
- src/ApiService
33
- src/agent
4-
- src/pytypes
4+
- src/cli
55
- src/deployment
6+
- src/proxy-manager
7+
- src/pytypes

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
with:
4747
toolchain: 1.68
4848
components: clippy, rustfmt, llvm-tools-preview
49+
- name: Setup Rust problem-matchers
50+
uses: r7kamura/rust-problem-matchers@d58b70c4a13c4866d96436315da451d8106f8f08 # pinned to 1.3.0
4951
- name: Get Rust version & build version
5052
shell: bash
5153
run: |

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
# Compiling is required for csharp
3535
- name: Setup .NET Core SDK
3636
if: ${{ matrix.language == 'csharp' }}
37-
uses: actions/setup-dotnet@v2
37+
uses: actions/setup-dotnet@v3
3838
with:
3939
dotnet-version: "7.0.x"
4040
dotnet-quality: "ga"

src/ApiService/ApiService/ApiService.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
44
<OutputType>Exe</OutputType>
@@ -14,7 +14,7 @@
1414
<PackageReference Include="Microsoft.Azure.AppConfiguration.Functions.Worker" Version="6.0.0" />
1515
<PackageReference Include="Microsoft.FeatureManagement" Version="2.5.1" />
1616
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
17-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="5.0.0" />
17+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="5.0.1" />
1818
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.EventGrid" Version="2.1.0" />
1919
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
2020
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.1.0" />
@@ -43,7 +43,7 @@
4343
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
4444
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.SignalRService" Version="1.7.0" />
4545
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
46-
<PackageReference Include="TaskTupleAwaiter" Version="2.0.0" />
46+
<PackageReference Include="TaskTupleAwaiter" Version="2.0.3" />
4747
<PackageReference Include="Scriban" Version="5.5.0" />
4848
<PackageReference Include="Octokit" Version="2.0.1" />
4949
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="19.219.0-preview" />

src/ApiService/ApiService/Functions/Notifications.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ private async Async.Task<HttpResponseData> Delete(HttpRequestData req) {
6767
if (entries.Count > 1) {
6868
return await _context.RequestHandling.NotOk(req, new Error(ErrorCode.INVALID_REQUEST, new[] { "error identifying Notification" }), context: "notification delete");
6969
}
70+
71+
var result = await _context.NotificationOperations.Delete(entries[0]);
72+
73+
if (!result.IsOk) {
74+
var (status, error) = result.ErrorV;
75+
return await _context.RequestHandling.NotOk(req, new Error(ErrorCode.UNABLE_TO_UPDATE, new[] { error }), "notification delete");
76+
}
77+
7078
var response = req.CreateResponse(HttpStatusCode.OK);
7179
await response.WriteAsJsonAsync(entries[0]);
7280
return response;

src/ApiService/ApiService/OneFuzzTypes/Events.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,13 @@ public record EventJobStopped(
143143
JobConfig Config,
144144
UserInfo? UserInfo,
145145
List<JobTaskStopped> TaskInfo
146-
) : BaseEvent();
146+
) : BaseEvent(), ITruncatable<BaseEvent> {
147+
public BaseEvent Truncate(int maxLength) {
148+
return this with {
149+
Config = Config.Truncate(maxLength)
150+
};
151+
}
152+
}
147153

148154

149155
[EventType(EventType.TaskCreated)]

src/ApiService/ApiService/OneFuzzTypes/Model.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,17 @@ public record JobConfig(
819819
string Build,
820820
long Duration,
821821
string? Logs
822-
);
822+
) : ITruncatable<JobConfig> {
823+
public JobConfig Truncate(int maxLength) {
824+
return new JobConfig(
825+
Project,
826+
Name,
827+
Build,
828+
Duration,
829+
Logs?[..maxLength]
830+
);
831+
}
832+
}
823833

824834
public record JobTaskInfo(
825835
Guid TaskId,
@@ -962,7 +972,8 @@ public record TaskUnitConfig(
962972
TaskType TaskType,
963973
string? InstanceTelemetryKey,
964974
string? MicrosoftTelemetryKey,
965-
Uri HeartbeatQueue
975+
Uri HeartbeatQueue,
976+
Dictionary<string, string> Tags
966977
) {
967978
public Uri? inputQueue { get; set; }
968979
public String? SupervisorExe { get; set; }

src/ApiService/ApiService/onefuzzlib/Config.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ private static BlobContainerSasPermissions ConvertPermissions(ContainerPermissio
7070
TaskType: task.Config.Task.Type,
7171
InstanceTelemetryKey: _serviceConfig.ApplicationInsightsInstrumentationKey,
7272
MicrosoftTelemetryKey: _serviceConfig.OneFuzzTelemetry,
73-
HeartbeatQueue: await _queue.GetQueueSas("task-heartbeat", StorageType.Config, QueueSasPermissions.Add) ?? throw new Exception("unable to get heartbeat queue sas")
73+
HeartbeatQueue: await _queue.GetQueueSas("task-heartbeat", StorageType.Config, QueueSasPermissions.Add) ?? throw new Exception("unable to get heartbeat queue sas"),
74+
Tags: task.Config.Tags ?? new Dictionary<string, string>()
7475
);
7576

7677
if (definition.MonitorQueue != null) {

src/ApiService/ApiService/onefuzzlib/Defs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public static class Defs {
416416
Permissions: ContainerPermission.Read | ContainerPermission.List
417417
),
418418
new ContainerDefinition(
419-
Type:ContainerType.UniqueReports,
419+
Type:ContainerType.UniqueInputs,
420420
Compare: Compare.Equal,
421421
Value:1,
422422
Permissions:

src/ApiService/ApiService/onefuzzlib/notifications/Ado.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,19 @@ public async Async.Task<string> Render(string template) {
146146
}
147147
}
148148

149-
public async IAsyncEnumerable<WorkItem> ExistingWorkItems() {
149+
public async IAsyncEnumerable<WorkItem> ExistingWorkItems((string, string)[] notificationInfo) {
150150
var filters = new Dictionary<string, string>();
151151
foreach (var key in _config.UniqueFields) {
152152
var filter = string.Empty;
153153
if (string.Equals("System.TeamProject", key)) {
154154
filter = await Render(_config.Project);
155+
} else if (_config.AdoFields.TryGetValue(key, out var field)) {
156+
filter = await Render(field);
155157
} else {
156-
filter = await Render(_config.AdoFields[key]);
158+
_logTracer.WithTags(notificationInfo).Error($"Failed to check for existing work items using the UniqueField Key: {key}. Value is not present in config field AdoFields.");
159+
continue;
157160
}
161+
158162
filters.Add(key.ToLowerInvariant(), filter);
159163
}
160164

@@ -327,7 +331,7 @@ private async Async.Task<WorkItem> CreateNew() {
327331
}
328332

329333
public async Async.Task Process((string, string)[] notificationInfo) {
330-
var matchingWorkItems = await ExistingWorkItems().ToListAsync();
334+
var matchingWorkItems = await ExistingWorkItems(notificationInfo).ToListAsync();
331335

332336
var nonDuplicateWorkItems = matchingWorkItems
333337
.Where(wi => !IsADODuplicateWorkItem(wi))

0 commit comments

Comments
 (0)