Skip to content

Conversation

Copy link

Copilot AI commented Oct 17, 2025

Overview

This PR expands the Build Failure service (DotNet.Status.Web.Controllers.AzurePipelinesController) to create work items in Azure DevOps (Azure Boards) in addition to GitHub issues. The Engineering Services team has moved all issue management to Azure DevOps, so this service now supports both platforms through configuration.

Changes

1. Extended Azure DevOps Client (src/Telemetry/AzureDevOpsClient/)

Added three new methods to IAzureDevOpsClient interface and implemented them in AzureDevOpsClient:

  • CreateBuildFailureWorkItem: Creates a new Azure DevOps work item with customizable title, description, assignee, area path, and tags
  • UpdateWorkItemComment: Adds comments to existing work items for tracking multiple failures
  • QueryWorkItemsByTitle: Queries for existing work items by title prefix to support "update existing" functionality

The implementation uses the Azure DevOps REST API v6.0 and v7.1-preview for work item creation and commenting.

2. Updated Configuration (src/DotNet.Status.Web/DotNet.Status.Web/Options/BuildMonitorOptions.cs)

Extended BuildMonitorOptions.IssuesOptions with new properties:

  • UseAzureDevOps: Boolean flag to enable Azure DevOps work item creation
  • AzureDevOpsProject: Target Azure DevOps project name
  • AzureDevOpsAreaPath: Area path for organizing work items

3. Refactored Controller (src/DotNet.Status.Web/DotNet.Status.Web/Controllers/AzurePipelinesController.cs)

Refactored ProcessBuildNotificationsAsync to support both GitHub and Azure DevOps:

  • CreateGitHubIssueAsync: Extracted existing GitHub issue creation logic (no functional changes)
  • CreateAzureDevOpsWorkItemAsync: New method for Azure DevOps work item creation with HTML-formatted descriptions
  • Routes to appropriate method based on UseAzureDevOps configuration flag
  • Supports "update existing" for both platforms - adds comments to existing work items/issues when multiple builds fail

4. Added Tests (src/DotNet.Status.Web/DotNet.Status.Web.Tests/AzurePipelinesControllerTests.cs)

  • Added new test configuration for Azure DevOps scenarios
  • Added BuildCompleteCreateAzureDevOpsWorkItem test to verify work item creation
  • Updated mock infrastructure to support Azure DevOps client methods

Configuration Example

To configure builds to create Azure DevOps work items:

{
  "Monitor": {
    "Organization": "dnceng",
    "Builds": [
      {
        "Project": "internal",
        "DefinitionPath": "\\dotnet\\runtime\\official",
        "Branches": ["main", "release/*"],
        "Assignee": "[email protected]",
        "IssuesId": "runtime-failures"
      }
    ]
  },
  "Issues": [
    {
      "Id": "runtime-failures",
      "UseAzureDevOps": true,
      "AzureDevOpsProject": "internal",
      "AzureDevOpsAreaPath": "internal\\Dotnet-Core-Engineering",
      "Labels": ["build-failure", "automated"],
      "UpdateExisting": true
    }
  ]
}

Key Features

Backward Compatible: Existing GitHub issue creation continues to work unchanged
Configuration-Driven: Teams can choose GitHub or Azure DevOps per build/repository
Feature Parity: Supports "update existing" functionality for both platforms
Rich Formatting: HTML formatting for Azure DevOps, Markdown for GitHub
Security: CodeQL scan passed with 0 vulnerabilities
Code Standards: Uses explicit types throughout (no var)

Testing

  • ✅ All existing tests pass
  • ✅ New test added for Azure DevOps work item creation
  • ✅ Builds successfully without warnings or errors
  • ✅ Security scan completed with no issues

Fixes #[issue-number]

Original prompt

This section details on the original issue you should resolve

<issue_title>Modify Build Failure service to open issues in Azure DevOps instead of GitHub</issue_title>
<issue_description>The DotNet.Status.Web.Controllers.AzurePipelinesController class in the DotNet.Status.Web project catches build completion webhooks from various Azure DevOps pipelines (defined in configuration files) and opens GitHub issues for certain states. The Engineering Services team has moved all issue management to Azure DevOps, so this service should now be expanded to open issues in Azure Boards. </issue_description>

<agent_instructions>Avoid the use of var, use explicit types instead. </agent_instructions>

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

Fixes #6360


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Modify Build Failure service to open issues in Azure DevOps Add Azure DevOps work item support to Build Failure service Oct 17, 2025
Copilot AI requested a review from garath October 17, 2025 21:38
Copilot finished work on behalf of garath October 17, 2025 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modify Build Failure service to open issues in Azure DevOps instead of GitHub

2 participants