feat: add retry capability for windows license activation
parent
9d6bdcbdc5
commit
f0154003a2
|
|
@ -15,10 +15,21 @@ Get-Process -Name regsvr32 | ForEach-Object { Stop-Process -Id $_.Id -Force }
|
|||
|
||||
# Activate Unity
|
||||
if ($env:SKIP_ACTIVATION -ne "true") {
|
||||
$maxRetries = 3
|
||||
$retryCount = 0
|
||||
do {
|
||||
. "c:\steps\activate.ps1"
|
||||
if ($ACTIVATION_EXIT_CODE -eq 0) {
|
||||
break
|
||||
}
|
||||
$retryCount++
|
||||
Write-Warning "Activation failed with exit code $ACTIVATION_EXIT_CODE. Retrying ($retryCount/$maxRetries)..."
|
||||
Start-Sleep -Seconds 5
|
||||
} while ($retryCount -lt $maxRetries)
|
||||
|
||||
# If we didn't activate successfully, exit with the exit code from the activation step.
|
||||
if ($ACTIVATION_EXIT_CODE -ne 0) {
|
||||
Write-Error "Unity activation failed after $maxRetries attempts with exit code $ACTIVATION_EXIT_CODE"
|
||||
exit $ACTIVATION_EXIT_CODE
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue