You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 64a5c8b
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Sync eng/common directory with azure-sdk-tools for PR 17155 (#3827)
New-TestResources: Resolve deployment state instead of blindly retrying on failure
New-AzResourceGroupDeployment retries reused the same -Name as the
original deployment. If the original was still running server-side
(e.g. a long-running template), the retry collided with it
(Code=DeploymentActive) and every retry failed the same way.
Resolve-DeploymentAfterFailure now asks ARM for the existing
deployment's actual state before deciding what to do:
- still running -> poll it to completion (bounded, 60 min timeout)
instead of starting a redundant concurrent deployment, which
could otherwise cause resource-level conflicts and leave an
orphaned duplicate deployment record behind
- already succeeded/failed/canceled -> return that result as-is so
normal failure handling reports the real error instead of masking
it with a retry
- not found at all -> safe to submit a new deployment under a
unique name, truncating the base name so the result stays within
ARM's 64-character deployment-name limit
Also resets $deployment to $null at the start of each
template-file iteration so a stale value from a previous template
can't leak through if the try block throws without assigning a new
one.
Co-authored-by: Connie Yau <conniey@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ce6c37d3-fb5b-4100-8c45-fc8ee31b4170
if ($existing.ProvisioningState-in$terminalStates) {
89
+
Write-Warning"Deployment '$DeploymentName' already reached terminal state '$($existing.ProvisioningState)' server-side."
90
+
return$existing
91
+
}
92
+
93
+
Write-Warning"Deployment '$DeploymentName' is still active server-side (state '$($existing.ProvisioningState)'). Polling instead of starting a redundant concurrent deployment."
if ($existing.ProvisioningState-in$terminalStates) {
116
+
return$existing
117
+
}
118
+
119
+
Start-Sleep-Seconds 15
120
+
}
121
+
122
+
if ($existing-and$existing.ProvisioningState-notin$terminalStates) {
123
+
throw"Timed out after $PollTimeoutMinutes minute(s) waiting for deployment '$DeploymentName' to finish. Latest provisioningState: '$($existing.ProvisioningState)'."
124
+
}
125
+
}
126
+
127
+
# No existing deployment record was found: nothing is actually in flight server-side (e.g.
128
+
# the client call failed before ARM even registered the deployment), so it's safe to submit
129
+
# a brand new deployment. ARM deployment names are limited to 64 characters; truncate only
130
+
# the base portion (not the unique "-retry-<suffix>" we append) so the result always stays
131
+
# within the limit, even when $DeploymentName is already close to 64 chars.
132
+
Write-Warning"No deployment named '$DeploymentName' was found; submitting a new deployment under a unique name."
0 commit comments