Skip to content

Commit 3905444

Browse files
committed
Moved polling into the validation step to avoid holding up builds.
1 parent e28a175 commit 3905444

4 files changed

Lines changed: 40 additions & 107 deletions

File tree

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ When a new issue is created, follow these steps:
133133
- All source code is in `src/Microsoft.Data.SqlClient/src/`. Do NOT add code to legacy `netfx/src/` or `netcore/src/` directories.
134134
- Only `ref/` folders in `netcore/ref/` and `netfx/ref/` remain active for defining the public API surface.
135135
- Check for platform-specific differences using file suffixes (`.netfx.cs`, `.netcore.cs`, `.windows.cs`, `.unix.cs`) and conditional compilation (`#if NETFRAMEWORK`, `#if NET`, `#if _WINDOWS`, `#if _UNIX`).
136+
- Lines of code, comments, and other text should be a maximum of 100 characters (see `policy/coding-style.md`).
136137
- Respect API compatibility rules across .NET versions
137138
- Do not introduce breaking changes without proper justification and documentation
138139
- Use the `doc/` directory for any new documentation or updates to existing documentation

eng/pipelines/onebranch/jobs/validate-symbols.ps1

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,15 @@ param(
6161
[string]$SymbolServerUrl,
6262

6363
[Parameter(Mandatory)]
64-
[string]$SymbolServerName
64+
[string]$SymbolServerName,
65+
66+
# Maximum number of attempts when symbols are not yet available. The first
67+
# attempt runs immediately; subsequent attempts wait RetryIntervalSeconds
68+
# between them. Defaults to 10 (~5 minutes total with default interval).
69+
[int]$MaxRetries = 10,
70+
71+
# Seconds to wait between retry attempts (default 30).
72+
[int]$RetryIntervalSeconds = 30
6573
)
6674

6775
Set-StrictMode -Version Latest
@@ -118,33 +126,41 @@ if (-not $symchkPath) {
118126
exit 1
119127
}
120128

121-
# ── Verify symbols ────────────────────────────────────────────────────────────
129+
# ── Verify symbols (with retries for publishing latency) ──────────────────────
122130

123131
$dllLeaf = Split-Path $dllFullPath -Leaf
124132

125133
Write-Host "Verifying symbols for $dllLeaf on $SymbolServerName ($SymbolServerUrl)"
126134
Write-Host "Using symchk: $symchkPath"
135+
Write-Host "Max attempts: $MaxRetries, interval: ${RetryIntervalSeconds}s"
127136

128137
$symchkArgs = @(
129138
$dllFullPath,
130139
"/s", "srv*$SymbolServerUrl",
131140
"/os"
132141
)
133142

134-
Write-Host "Running: symchk $($symchkArgs -join ' ')"
135-
$output = & $symchkPath @symchkArgs 2>&1 | Out-String
136-
$symchkExit = $LASTEXITCODE
143+
for ($attempt = 1; $attempt -le $MaxRetries; $attempt++) {
144+
Write-Host "Attempt $attempt of $MaxRetries — running: symchk $($symchkArgs -join ' ')"
145+
$output = & $symchkPath @symchkArgs 2>&1 | Out-String
146+
$symchkExit = $LASTEXITCODE
137147

138-
Write-Host $output
148+
Write-Host $output
139149

140-
if ($symchkExit -ne 0) {
141-
Write-Host "##vso[task.logissue type=error]symchk failed for $dllLeaf on $SymbolServerName (exit code: $symchkExit)"
142-
exit 1
143-
}
150+
$passed = ($symchkExit -eq 0) -and
151+
($output -match "FAILED files = 0") -and
152+
($output -match "PASSED \+ IGNORED files = [1-9]")
144153

145-
if ($output -match "FAILED files = 0" -and $output -match "PASSED \+ IGNORED files = [1-9]") {
146-
Write-Host "Symbols verified successfully for $dllLeaf on $SymbolServerName"
147-
} else {
148-
Write-Host "##vso[task.logissue type=error]symchk did not confirm symbols for $dllLeaf on $SymbolServerName"
149-
exit 1
154+
if ($passed) {
155+
Write-Host "Symbols verified successfully for $dllLeaf on $SymbolServerName"
156+
exit 0
157+
}
158+
159+
if ($attempt -lt $MaxRetries) {
160+
Write-Host "Symbols not yet available. Retrying in $RetryIntervalSeconds seconds..."
161+
Start-Sleep -Seconds $RetryIntervalSeconds
162+
}
150163
}
164+
165+
Write-Host "##vso[task.logissue type=error]symchk could not verify symbols for $dllLeaf on $SymbolServerName after $MaxRetries attempts."
166+
exit 1

eng/pipelines/onebranch/steps/compound-publish-symbols-step.yml

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -137,49 +137,7 @@ steps:
137137
-Body $publishSymbolsBody
138138
echo "> 3.Request to publish symbols submitted successfully."
139139
140-
# Poll until symbol publishing completes on all requested servers.
141-
#
142-
# PublishingStatus: 0=NotRequested, 1=Submitted, 2=Processing, 3=Completed
143-
# PublishingResult: 0=Pending, 1=Succeeded, 2=Failed, 3=Cancelled
144-
#
145-
echo "> 4.Waiting for symbol publishing to complete..."
146-
147-
$baseUri = "https://$publishServer.trafficmanager.net/projects/$publishProjectName/requests/$artifactName"
148-
$headers = @{ Authorization = "Bearer $symbolPublishingToken" }
149-
$timeoutMinutes = 30
150-
$pollIntervalSeconds = 30
151-
$deadline = (Get-Date).AddMinutes($timeoutMinutes)
152-
153-
while ((Get-Date) -lt $deadline) {
154-
$status = Invoke-RestMethod -Method GET -Uri $baseUri -Headers $headers -ContentType "application/json"
155-
156-
$serversToCheck = @()
157-
if ($publishToInternal -eq 'true') { $serversToCheck += @{ Name = 'Internal'; Status = $status.internalServerStatus; Result = $status.internalServerResult } }
158-
if ($publishToPublic -eq 'true') { $serversToCheck += @{ Name = 'Public'; Status = $status.publicServerStatus; Result = $status.publicServerResult } }
159-
160-
$allCompleted = $true
161-
foreach ($server in $serversToCheck) {
162-
echo " $($server.Name): Status=$($server.Status) Result=$($server.Result)"
163-
if ($server.Status -ne 3) { $allCompleted = $false }
164-
}
165-
166-
if ($allCompleted) {
167-
$anyFailed = $false
168-
foreach ($server in $serversToCheck) {
169-
if ($server.Result -ne 1) {
170-
echo "##vso[task.logissue type=error]Symbol publishing to $($server.Name) server did not succeed (Result=$($server.Result))."
171-
$anyFailed = $true
172-
}
173-
}
174-
if ($anyFailed) { exit 1 }
175-
echo "> 4.Symbol publishing completed successfully on all requested servers."
176-
break
177-
}
178-
179-
echo " Publishing still in progress, waiting $pollIntervalSeconds seconds..."
180-
Start-Sleep -Seconds $pollIntervalSeconds
181-
}
182-
183-
if ((Get-Date) -ge $deadline) {
184-
echo "##vso[task.logissue type=warning]Symbol publishing did not complete within $timeoutMinutes minutes. Verification may fail."
185-
}
140+
# Publishing status will be verified by the validate-symbols job in the
141+
# validation stage (via symchk). Polling here would block subsequent
142+
# build stages unnecessarily — enough time typically elapses during the
143+
# remaining build stages for publishing to complete before validation.

eng/pipelines/onebranch/steps/publish-symbols-step.yml

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -97,49 +97,7 @@ steps:
9797
9898
echo "> 3.Request to publish symbols succeeded."
9999
100-
# Poll until symbol publishing completes on all requested servers.
101-
#
102-
# PublishingStatus: 0=NotRequested, 1=Submitted, 2=Processing, 3=Completed
103-
# PublishingResult: 0=Pending, 1=Succeeded, 2=Failed, 3=Cancelled
104-
#
105-
echo "> 4.Waiting for symbol publishing to complete..."
106-
107-
$baseUri = "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName"
108-
$headers = @{ Authorization = "Bearer $symbolPublishingToken" }
109-
$timeoutMinutes = 30
110-
$pollIntervalSeconds = 30
111-
$deadline = (Get-Date).AddMinutes($timeoutMinutes)
112-
113-
while ((Get-Date) -lt $deadline) {
114-
$status = Invoke-RestMethod -Method GET -Uri $baseUri -Headers $headers -ContentType "application/json"
115-
116-
$serversToCheck = @()
117-
if ($publishToInternalServer -eq 'true') { $serversToCheck += @{ Name = 'Internal'; Status = $status.internalServerStatus; Result = $status.internalServerResult } }
118-
if ($publishToPublicServer -eq 'true') { $serversToCheck += @{ Name = 'Public'; Status = $status.publicServerStatus; Result = $status.publicServerResult } }
119-
120-
$allCompleted = $true
121-
foreach ($server in $serversToCheck) {
122-
echo " $($server.Name): Status=$($server.Status) Result=$($server.Result)"
123-
if ($server.Status -ne 3) { $allCompleted = $false }
124-
}
125-
126-
if ($allCompleted) {
127-
$anyFailed = $false
128-
foreach ($server in $serversToCheck) {
129-
if ($server.Result -ne 1) {
130-
echo "##vso[task.logissue type=error]Symbol publishing to $($server.Name) server did not succeed (Result=$($server.Result))."
131-
$anyFailed = $true
132-
}
133-
}
134-
if ($anyFailed) { exit 1 }
135-
echo "> 4.Symbol publishing completed successfully on all requested servers."
136-
break
137-
}
138-
139-
echo " Publishing still in progress, waiting $pollIntervalSeconds seconds..."
140-
Start-Sleep -Seconds $pollIntervalSeconds
141-
}
142-
143-
if ((Get-Date) -ge $deadline) {
144-
echo "##vso[task.logissue type=warning]Symbol publishing did not complete within $timeoutMinutes minutes. Verification may fail."
145-
}
100+
# Publishing status will be verified by the validate-symbols job in the
101+
# validation stage (via symchk). Polling here would block subsequent
102+
# build stages unnecessarily — enough time typically elapses during the
103+
# remaining build stages for publishing to complete before validation.

0 commit comments

Comments
 (0)