Skip to content

Add a script to only retry failed AzDo jobs - #38761

Merged
AndriySvyryd merged 4 commits into
mainfrom
RetryValidation
Aug 20, 2026
Merged

AndriySvyryd merged 4 commits into
mainfrom
RetryValidation

Conversation

@AndriySvyryd

Copy link
Copy Markdown
Member

No description provided.

@AndriySvyryd
AndriySvyryd requested a lite review from Copilot August 6, 2026 21:41
@AndriySvyryd
AndriySvyryd requested a review from wtgodbe as a code owner August 6, 2026 21:41

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds an Azure DevOps “grouped job validation” mechanism that can queue a child build on validation retries, running only the jobs needed for failed logical groups.

Changes:

  • Introduces eng/aggregate-azdo-tests.ps1 to compute failed groups, queue a retry build for only required jobs, and merge retried results.
  • Adds a jobs pipeline parameter and per-job condition gates so a child build can run a targeted subset of jobs.
  • Updates the “Validate_Job_Results” job to call the new aggregator script and sets SYSTEM_ACCESSTOKEN for REST API calls.

Reviewed changes

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

File Description
eng/aggregate-azdo-tests.ps1 New script to evaluate grouped outcomes and drive targeted retry builds via AzDO REST API.
azure-pipelines-public.yml Adds jobs parameter + job-level gating and invokes the new aggregation script with OAuth token.
azure-pipelines-internal-tests.yml Same gating/aggregation pattern for internal pipeline; adjusts isAssetlessBuild based on job selection.

Comment thread eng/aggregate-azdo-tests.ps1 Resolved
Comment thread eng/aggregate-azdo-tests.ps1 Resolved
Comment thread eng/aggregate-azdo-tests.ps1 Resolved
Copilot AI review requested due to automatic review settings August 6, 2026 22:54

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

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

Suppressed comments (1)

eng/aggregate-azdo-tests.ps1:6

  • Add strict error handling at the top of this script. Most eng PowerShell scripts set $ErrorActionPreference = 'Stop' and Set-StrictMode -Version 2.0 (e.g. eng/common/internal-feed-operations.ps1:9-10) to avoid non-terminating errors silently continuing, which is especially important around REST calls and hashtable lookups.

@wtgodbe wtgodbe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Couple questions/concerns

Comment thread eng/aggregate-azdo-tests.ps1 Resolved
Comment thread eng/aggregate-azdo-tests.ps1 Resolved
@AndriySvyryd
AndriySvyryd enabled auto-merge (squash) August 20, 2026 00:24
Copilot AI review requested due to automatic review settings August 20, 2026 00:25

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

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

Suppressed comments (2)

eng/aggregate-azdo-tests.ps1:152

  • This loop's $ran/continue checks don’t affect control flow or outcome (there’s no else branch and failures are handled via $failedGroups after the loop). Keeping the dead conditional logic is confusing; either remove it or make it update $failedGroups.
    $ran = @($results | Where-Object { $_ -ne 'Skipped' })
    if ($ran.Count -eq 0)
    {
        Write-Host '  -> all jobs skipped, treating group as successful'
        continue

eng/aggregate-azdo-tests.ps1:131

  • When merging results from the retry build timeline, $record.result comes from the Build Timeline REST API TaskResult enum (e.g. succeeded, failed, skipped). The rest of this script expects pipeline-style result strings like Succeeded/Skipped, so successes/skips from the retried build will be misclassified and can cause false group failures.
        $record = Get-JobRecord $timeline $jobName
        if ($null -eq $record)
        {
            throw "Could not find timeline record for retried job '$jobName'."
        }

        $JobResults[$jobName] = $record.result

Copilot AI review requested due to automatic review settings August 20, 2026 00:34

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

eng/aggregate-azdo-tests.ps1:45

  • Get-JobRecord searches timeline job records by name == $displayName. In the build timeline API, job records commonly use the YAML job name (e.g. Helix_Windows, Windows_SqlServer) as name, so filtering only by display name can fail to find the record and will break the retry path. Consider matching both the job ID and the display name (and optionally refName) to be resilient across timeline shapes.
    @($timeline.records
        | Where-Object { $_.type -eq 'Job' -and $_.name -eq $displayName }
        | Sort-Object attempt -Descending)[0]

Comment thread eng/aggregate-azdo-tests.ps1 Resolved
Copilot AI review requested due to automatic review settings August 20, 2026 00:42

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

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

Suppressed comments (1)

eng/aggregate-azdo-tests.ps1:113

  • The retry-build wait loop sleeps before the first status check, and can overshoot the intended deadline by up to one full sleep interval (60s). Given the Validate_Job_Results timeout is 200 minutes, this can cause the job to be killed by the pipeline timeout before the script reaches its own timeout handling.
    do
    {
        Start-Sleep -Seconds 60
        $retryBuild = Invoke-RestMethod -Uri "$buildsUri/$($retryBuild.id)?api-version=7.1" -Headers $headers
    }

@AndriySvyryd
AndriySvyryd disabled auto-merge August 20, 2026 01:21
@AndriySvyryd
AndriySvyryd merged commit 124968a into main Aug 20, 2026
27 of 29 checks passed
@AndriySvyryd
AndriySvyryd deleted the RetryValidation branch August 20, 2026 01:21
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Aug 20, 2026
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