Skip to content

JobMonitor: Fetch test run tags from a different API - #17054

Merged
premun merged 1 commit into
dotnet:mainfrom
premun:prvysoky/tags
Jun 26, 2026
Merged

premun merged 1 commit into
dotnet:mainfrom
premun:prvysoky/tags

Conversation

@premun

@premun premun commented Jun 26, 2026 •

Copy link
Copy Markdown
Member

The previous one does not work, the new one does.
New api example: https://vstmr.dev.azure.com/dnceng-public/public/_apis/testresults/runs/40914222?includeTags=true&api-version=7.1-preview.1

Before we had this:

##[error]Helix Job Monitor terminated with an unhandled exception.
      System.Net.Http.HttpRequestException: Request to https://vstmr.dev.azure.com/dnceng-public/public/_apis/testresults/runs/40914222/tags?api-version=7.1-preview.1 failed with 405 Method Not Allowed. {"count":1,"value":{"Message":"The requested resource does not support http method 'GET'."}}
         at Microsoft.DotNet.Helix.JobMonitor.AzureDevOpsService.<>c__DisplayClass24_0.<<SendForStringAsync>b__0>d.MoveNext() in /_/src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs:line 465
      --- End of stack trace from previous location ---
         at Microsoft.DotNet.Helix.AzureDevOpsTestPublisher.RetryHelper.RetryAsync[T](Func`1 action, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/AzureDevOpsTestPublisher/RetryHelper.cs:line 17
         at Microsoft.DotNet.Helix.JobMonitor.AzureDevOpsService.SendForStringAsync(HttpMethod method, String requestUri, JToken body, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs:line 452
         at Microsoft.DotNet.Helix.JobMonitor.AzureDevOpsService.SendAsync(HttpMethod method, String requestUri, JToken body, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs:line 443
         at Microsoft.DotNet.Helix.JobMonitor.AzureDevOpsService.GetHelixJobNameFromRunTagsAsync(Int32 runId, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs:line 187
         at Microsoft.DotNet.Helix.JobMonitor.AzureDevOpsService.GetFailedTestWorkItemsAsync(CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs:line 132
         at Microsoft.DotNet.Helix.JobMonitor.JobMonitorRunner.ExecuteRetryPassAsync(CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs:line 145
         at Microsoft.DotNet.Helix.JobMonitor.JobMonitorRunner.RunAsync(CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs:line 94
         at Microsoft.DotNet.Helix.JobMonitor.Program.Main(String[] args) in /_/src/Microsoft.DotNet.Helix/JobMonitor/Program.cs:line 86

The previous one does not work, the new one does.

Before we had this:
```
##[error]Helix Job Monitor terminated with an unhandled exception.
      System.Net.Http.HttpRequestException: Request to https://vstmr.dev.azure.com/dnceng-public/public/_apis/testresults/runs/40914222/tags?api-version=7.1-preview.1 failed with 405 Method Not Allowed. {"count":1,"value":{"Message":"The requested resource does not support http method 'GET'."}}
         at Microsoft.DotNet.Helix.JobMonitor.AzureDevOpsService.<>c__DisplayClass24_0.<<SendForStringAsync>b__0>d.MoveNext() in /_/src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs:line 465
      --- End of stack trace from previous location ---
         at Microsoft.DotNet.Helix.AzureDevOpsTestPublisher.RetryHelper.RetryAsync[T](Func`1 action, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/AzureDevOpsTestPublisher/RetryHelper.cs:line 17
         at Microsoft.DotNet.Helix.JobMonitor.AzureDevOpsService.SendForStringAsync(HttpMethod method, String requestUri, JToken body, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs:line 452
         at Microsoft.DotNet.Helix.JobMonitor.AzureDevOpsService.SendAsync(HttpMethod method, String requestUri, JToken body, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs:line 443
         at Microsoft.DotNet.Helix.JobMonitor.AzureDevOpsService.GetHelixJobNameFromRunTagsAsync(Int32 runId, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs:line 187
         at Microsoft.DotNet.Helix.JobMonitor.AzureDevOpsService.GetFailedTestWorkItemsAsync(CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs:line 132
         at Microsoft.DotNet.Helix.JobMonitor.JobMonitorRunner.ExecuteRetryPassAsync(CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs:line 145
         at Microsoft.DotNet.Helix.JobMonitor.JobMonitorRunner.RunAsync(CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs:line 94
         at Microsoft.DotNet.Helix.JobMonitor.Program.Main(String[] args) in /_/src/Microsoft.DotNet.Helix/JobMonitor/Program.cs:line 86
```
Copilot AI review requested due to automatic review settings June 26, 2026 12:20
@premun
premun enabled auto-merge (squash) June 26, 2026 12:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Helix JobMonitor’s Azure DevOps integration to fetch per-test-run tags via the Get Test Run endpoint with includeTags=true, avoiding the /tags sub-resource that returns 405 Method Not Allowed for GET. This aligns the JobMonitor behavior with the working API shape described in the PR.

Changes:

  • Switched per-run tag retrieval from .../testresults/runs/{id}/tags to .../testresults/runs/{id}?includeTags=true.
  • Updated JSON parsing to read tags from the tags property on the TestRun payload.
  • Adjusted unit tests to mock the new endpoint and response schema.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs Uses Get-Run (includeTags=true) and parses tags[] inline to recover the Helix job tag without hitting the unsupported /tags GET endpoint.
src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/AzureDevOpsServiceTests.cs Updates request routing and mocked responses to validate the new per-run Get-Run tags flow end-to-end.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@premun
premun merged commit ac75e9c into dotnet:main Jun 26, 2026
9 of 10 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 1, 2026
@premun
premun deleted the prvysoky/tags branch July 23, 2026 10: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.

3 participants