Repository navigation
Add a script to only retry failed AzDo jobs - #38761
Conversation
There was a problem hiding this comment.
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.ps1to compute failed groups, queue a retry build for only required jobs, and merge retried results. - Adds a
jobspipeline parameter and per-jobconditiongates 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_ACCESSTOKENfor 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. |
c73af3b to
34b6195
Compare
There was a problem hiding this comment.
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'andSet-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.
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
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/continuechecks don’t affect control flow or outcome (there’s noelsebranch and failures are handled via$failedGroupsafter 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.resultcomes from the Build Timeline REST APITaskResultenum (e.g.succeeded,failed,skipped). The rest of this script expects pipeline-style result strings likeSucceeded/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
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
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) asname, 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 optionallyrefName) to be resilient across timeline shapes.
@($timeline.records
| Where-Object { $_.type -eq 'Job' -and $_.name -eq $displayName }
| Sort-Object attempt -Descending)[0]
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
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
}
No description provided.