upd deploy
This commit is contained in:
parent
535f3aca38
commit
3214fd5364
|
|
@ -1 +1 @@
|
||||||
1.2.4
|
1.2.5
|
||||||
|
|
@ -129,6 +129,13 @@ Write-Host "=== Restart App Service ===" -ForegroundColor Cyan
|
||||||
az webapp restart --name $APP --resource-group $RG
|
az webapp restart --name $APP --resource-group $RG
|
||||||
|
|
||||||
Write-Host "=== Post-Deploy DB Validation ===" -ForegroundColor Cyan
|
Write-Host "=== Post-Deploy DB Validation ===" -ForegroundColor Cyan
|
||||||
|
|
||||||
|
$validationOk = $false
|
||||||
|
$keepValidating = $true
|
||||||
|
|
||||||
|
while ($keepValidating) {
|
||||||
|
$keepValidating = $false
|
||||||
|
|
||||||
Write-Host " Waiting for server to boot (~20s)..." -ForegroundColor DarkGray
|
Write-Host " Waiting for server to boot (~20s)..." -ForegroundColor DarkGray
|
||||||
$bootDeadline = (Get-Date).AddSeconds(45)
|
$bootDeadline = (Get-Date).AddSeconds(45)
|
||||||
$serverReady = $false
|
$serverReady = $false
|
||||||
|
|
@ -143,7 +150,6 @@ if (-not $serverReady) {
|
||||||
Write-Host " WARNING: Server did not respond within 45s" -ForegroundColor Red
|
Write-Host " WARNING: Server did not respond within 45s" -ForegroundColor Red
|
||||||
}
|
}
|
||||||
|
|
||||||
$validationOk = $false
|
|
||||||
if ($serverReady -and $env:KA_NOTE_DEPLOY_API_KEY) {
|
if ($serverReady -and $env:KA_NOTE_DEPLOY_API_KEY) {
|
||||||
$authHeader = @{ Authorization = "Bearer $env:KA_NOTE_DEPLOY_API_KEY" }
|
$authHeader = @{ Authorization = "Bearer $env:KA_NOTE_DEPLOY_API_KEY" }
|
||||||
$maxRetries = 6
|
$maxRetries = 6
|
||||||
|
|
@ -180,8 +186,11 @@ if (-not $validationOk) {
|
||||||
Write-Host " !! DB appears empty or unreachable after deploy !!" -ForegroundColor Red
|
Write-Host " !! DB appears empty or unreachable after deploy !!" -ForegroundColor Red
|
||||||
Write-Host " Pre-deploy backup: $($latestBackup.FullName)" -ForegroundColor Yellow
|
Write-Host " Pre-deploy backup: $($latestBackup.FullName)" -ForegroundColor Yellow
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
$answer = Read-Host " Restore backup to prod? (yes/no)"
|
$answer = Read-Host " Restore backup to prod? (yes/no/retry)"
|
||||||
if ($answer -eq 'yes') {
|
if ($answer -eq 'retry') {
|
||||||
|
Write-Host " Retrying validation..." -ForegroundColor Cyan
|
||||||
|
$keepValidating = $true
|
||||||
|
} elseif ($answer -eq 'yes') {
|
||||||
Write-Host " Uploading backup to prod..." -ForegroundColor Cyan
|
Write-Host " Uploading backup to prod..." -ForegroundColor Cyan
|
||||||
Invoke-WebRequest -Uri $KuduDbUrl `
|
Invoke-WebRequest -Uri $KuduDbUrl `
|
||||||
-Method PUT `
|
-Method PUT `
|
||||||
|
|
@ -195,6 +204,7 @@ if (-not $validationOk) {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "=== Done! $VERSION deployed ===" -ForegroundColor Green
|
Write-Host "=== Done! $VERSION deployed ===" -ForegroundColor Green
|
||||||
Write-Host "Check: https://$APP.azurewebsites.net"
|
Write-Host "Check: https://$APP.azurewebsites.net"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue