dnceng icon indicating copy to clipboard operation
dnceng copied to clipboard

Migrate AlertHookController from GitHub Issues to Azure DevOps Work Items

Open Copilot opened this issue 2 months ago • 6 comments

  • [x] Add IAzureDevOpsClient methods for creating and updating work items with tags/labels
  • [x] Create new AzureDevOpsAlertOptions configuration class for Alert-specific Azure DevOps settings
  • [x] Update AlertHookController to use IAzureDevOpsClient instead of GitHub client
  • [x] Update Startup.cs to configure AzureDevOpsAlertOptions
  • [x] Replace GitHub-specific logic with Azure DevOps work item operations
  • [x] Update issue creation to work item creation
  • [x] Update issue search/retrieval to work item queries
  • [x] Update label operations to work item tag operations
  • [x] Fix HTTP methods for Azure DevOps API (PATCH for updates)
  • [x] Fix syntax errors - use HttpRequestMessage for PATCH compatibility
  • [x] Improve configuration handling with proper null checks
  • [x] Fix string interpolation in HTML generation
  • [x] Update mock implementations for tests
  • [x] Verify code follows requirements (no var, IOptions pattern)
  • [x] Build validation passed
  • [x] Test validation passed

Summary

Successfully migrated the AlertHookController from GitHub to Azure DevOps. All build and test errors have been resolved.

Recent Fixes:

  • Added missing interface methods to MockAzureClient and MockTimeoutAzureClient test implementations
  • All tests pass successfully (11/11 tests in AzureDevOpsTimeline.Tests)

The implementation is ready for testing.

Original prompt

This section details on the original issue you should resolve

<issue_title>Modify DotNet.Status.Web to open Grafana Alert issues in Azure DevOps instead of GitHub</issue_title> <issue_description>The AlertHookController of DotNet.Status.Web is in charge of receiving webhooks from Grafana that represent alerts (including new notifications and updates of existing notifications). It then processes this information and either creates a new issue or updaets an existing issue in GitHub.

This should be modified to open issues in Azure DevOps instead. </issue_description>

<agent_instructions>Avoid the use of var, use direct types instead. Leverage the IOptions configuration pattern for information about the target Azure DevOps instance. </agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes dotnet/dnceng#6314


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Oct 14 '25 21:10 Copilot

@copilot the CI build failed, indicating syntax errors in the files you changed. Please fix those.

garath avatar Oct 14 '25 22:10 garath

@copilot the CI build failed, indicating syntax errors in the files you changed. Please fix those.

Fixed the syntax errors in commit 0ba3da4:

  1. Replaced HttpClient.PatchAsync() with HttpRequestMessage using the PATCH method for better compatibility across .NET versions
  2. Improved the configuration lambda in Startup.cs with explicit variable declarations and proper null/default value handling

The code should now build successfully.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 1k9vsblobprodcus379.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)
  • 51yvsblobprodcus36.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)
  • 8xbvsblobprodcus382.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)
  • c50vsblobprodcus330.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)
  • c78vsblobprodcus322.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)
  • k0ivsblobprodcus356.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)
  • kh4vsblobprodcus325.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)
  • l49vsblobprodcus358.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)
  • m6xvsblobprodcus342.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)
  • n3kvsblobprodcus335.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)
  • pdfvsblobprodcus380.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)
  • sc4vsblobprodcus331.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)
  • uy6vsblobprodcus34.vsblob.vsassets.io
    • Triggering command: dotnet build src/DotNet.Status.Web/DotNet.Status.Web/DotNet.Status.Web.csproj (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot avatar Oct 14 '25 22:10 Copilot

@copilot try your build again. I think I fixed the permissions to allow you to build and restore projects.

garath avatar Oct 14 '25 22:10 garath

@copilot try your build again. I think I fixed the permissions to allow you to build and restore projects.

Build successful! Fixed string interpolation syntax errors in commit 4a9a662. Both DotNet.Status.Web and AzureDevOpsClient projects now compile without errors.

Copilot avatar Oct 14 '25 22:10 Copilot

@copilot CI build is still failing with errors like "'MockAzureClient' does not implement interface member 'IAzureDevOpsClient.CreateAlertWorkItem(string, string, string, string[], CancellationToken)'". Please fix.

garath avatar Oct 14 '25 22:10 garath

@copilot CI build is still failing with errors like "'MockAzureClient' does not implement interface member 'IAzureDevOpsClient.CreateAlertWorkItem(string, string, string, string[], CancellationToken)'...

Fixed in commit 8e7f15d. Added the missing interface methods (CreateAlertWorkItem, UpdateWorkItemTags, AddWorkItemComment, QueryWorkItemsByTag) to both MockAzureClient and MockTimeoutAzureClient. All tests pass successfully.

Copilot avatar Oct 14 '25 22:10 Copilot