From f0154003a25bee03a596785729cc93d7be114b2e Mon Sep 17 00:00:00 2001 From: kijz Date: Tue, 11 Mar 2025 15:20:54 +0100 Subject: [PATCH 1/2] feat: add retry capability for windows license activation --- dist/platforms/windows/entrypoint.ps1 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dist/platforms/windows/entrypoint.ps1 b/dist/platforms/windows/entrypoint.ps1 index 4d7057e6f..071b272fc 100644 --- a/dist/platforms/windows/entrypoint.ps1 +++ b/dist/platforms/windows/entrypoint.ps1 @@ -15,10 +15,21 @@ Get-Process -Name regsvr32 | ForEach-Object { Stop-Process -Id $_.Id -Force } # Activate Unity if ($env:SKIP_ACTIVATION -ne "true") { - . "c:\steps\activate.ps1" + $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 } } From dc62320a293dfa64dfbeb555e28e03f07bc9fa65 Mon Sep 17 00:00:00 2001 From: kijz Date: Tue, 11 Mar 2025 15:22:30 +0100 Subject: [PATCH 2/2] feat: exit with code 1, which is failure for windows --- dist/platforms/windows/entrypoint.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/platforms/windows/entrypoint.ps1 b/dist/platforms/windows/entrypoint.ps1 index 071b272fc..5c86f8c7c 100644 --- a/dist/platforms/windows/entrypoint.ps1 +++ b/dist/platforms/windows/entrypoint.ps1 @@ -30,7 +30,7 @@ if ($env:SKIP_ACTIVATION -ne "true") { # 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 + exit 1 # exit code 1 is failure on windows } } else {