Skip to content

Commit d565bcf

Browse files
author
CoLiPas Builder
committed
Retry production page validation
1 parent d8be986 commit d565bcf

2 files changed

Lines changed: 38 additions & 13 deletions

File tree

scripts/release-deploy.ps1

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,39 @@ function Require-Command {
5252
return $command.Source
5353
}
5454

55+
function Invoke-ProductionBrowserValidation {
56+
param(
57+
[object]$Target,
58+
[int]$MaxAttempts = 3,
59+
[int]$RetryDelaySeconds = 8
60+
)
61+
62+
for ($attempt = 1; $attempt -le $MaxAttempts; $attempt++) {
63+
$env:PUBLIC_PAGES_BASE_URL = $Target.publicBaseUrl
64+
$env:PUBLIC_PAGES_MODE = $Target.publicMode
65+
try {
66+
node scripts/public-pages-check.mjs
67+
$validationExitCode = $LASTEXITCODE
68+
if ($validationExitCode -eq 0) {
69+
return
70+
}
71+
72+
throw "public-pages-check exited with code $validationExitCode"
73+
} catch {
74+
if ($attempt -ge $MaxAttempts) {
75+
throw "Production browser validation failed for target $($Target.name) after $MaxAttempts attempts: $_"
76+
}
77+
78+
Write-Warning "Production browser validation attempt $attempt/$MaxAttempts failed for target $($Target.name): $_"
79+
Start-Sleep -Seconds $RetryDelaySeconds
80+
} finally {
81+
Remove-Item Env:\PUBLIC_PAGES_BASE_URL -ErrorAction SilentlyContinue
82+
Remove-Item Env:\PUBLIC_PAGES_MODE -ErrorAction SilentlyContinue
83+
$global:LASTEXITCODE = 0
84+
}
85+
}
86+
}
87+
5588
function Resolve-LocalPath {
5689
param([string]$Value)
5790

@@ -631,18 +664,7 @@ Run-Step "Production target browser validation" {
631664
}
632665

633666
Write-Host "Validating $($target.name) at $($target.publicBaseUrl) in $($target.publicMode) mode."
634-
$env:PUBLIC_PAGES_BASE_URL = $target.publicBaseUrl
635-
$env:PUBLIC_PAGES_MODE = $target.publicMode
636-
try {
637-
node scripts/public-pages-check.mjs
638-
$validationExitCode = $LASTEXITCODE
639-
if ($validationExitCode -ne 0) {
640-
throw "Production browser validation failed for target $($target.name) with exit code $validationExitCode."
641-
}
642-
} finally {
643-
Remove-Item Env:\PUBLIC_PAGES_BASE_URL -ErrorAction SilentlyContinue
644-
Remove-Item Env:\PUBLIC_PAGES_MODE -ErrorAction SilentlyContinue
645-
}
667+
Invoke-ProductionBrowserValidation -Target $target
646668
}
647669
}
648670

scripts/smoke.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3082,7 +3082,10 @@ function assertAccountUiGuards() {
30823082
"PUBLIC_PAGES_MODE: 'admin'",
30833083
"['scripts/public-pages-check.mjs']",
30843084
'Production target browser validation',
3085-
'$env:PUBLIC_PAGES_BASE_URL = $target.publicBaseUrl',
3085+
'$env:PUBLIC_PAGES_BASE_URL = $Target.publicBaseUrl',
3086+
'Invoke-ProductionBrowserValidation',
3087+
'[int]$MaxAttempts = 3',
3088+
'Start-Sleep -Seconds $RetryDelaySeconds',
30863089
'foreach ($target in $DeployTargets)',
30873090
'skipPublicValidation',
30883091
'buildLandingCheck',

0 commit comments

Comments
 (0)