fix: deploy health via docker exec (prod port bound to VM IP), safe rollback, error propagation, VPN retry, release default + download verification
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+19
-1
@@ -48,11 +48,29 @@ try {
|
||||
if ($LASTEXITCODE -ne 0) { throw "tests failed - deploy aborted" }
|
||||
}
|
||||
|
||||
# 4. route/SSH recovery: reconnect the existing Windows VPN profile "GTI" (saved credentials) and retry
|
||||
$reachable = $false
|
||||
for ($i = 1; $i -le 3 -and -not $reachable; $i++) {
|
||||
$reachable = (Test-NetConnection 10.0.10.117 -Port 22 -WarningAction SilentlyContinue).TcpTestSucceeded
|
||||
if (-not $reachable) {
|
||||
Write-Host "SSH_UNREACHABLE attempt=$i - reconnecting VPN profile GTI"
|
||||
rasdial GTI | Out-Null
|
||||
Start-Sleep -Seconds (10 * $i)
|
||||
}
|
||||
}
|
||||
if (-not $reachable) { throw "FAILED_STAGE=network REMOTE_ERROR=10.0.10.117:22 unreachable after 3 attempts (VPN profile GTI)" }
|
||||
Write-Host "SSH_ROUTE_OK"
|
||||
Remove-Item (Join-Path $LogDir "last_deploy_result.json") -ErrorAction SilentlyContinue
|
||||
|
||||
$deployArgs = @("scripts\deploy_hub_remote.py", "--version", $Version)
|
||||
if ($DryRun) { $deployArgs += "--dry-run" }
|
||||
if ($PublishAgent) { $deployArgs += "--publish-agent" }
|
||||
& $Python @deployArgs
|
||||
if ($LASTEXITCODE -ne 0) { throw "remote deploy failed (see ROLLBACK_REQUIRED above)" }
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
$res = Join-Path $LogDir "last_deploy_result.json"
|
||||
$detail = if (Test-Path $res) { $j = Get-Content $res -Raw | ConvertFrom-Json; "FAILED_STAGE/ERROR=$($j.error) ROLLBACK_REQUIRED=$($j.rollback_required)" } else { "no result file (see $Log)" }
|
||||
throw "remote deploy failed: $detail"
|
||||
}
|
||||
Write-Host "DEPLOY_SCRIPT_OK log=$Log"
|
||||
} finally {
|
||||
Remove-Item Env:GTI_SSH_PASSWORD -ErrorAction SilentlyContinue
|
||||
|
||||
Reference in New Issue
Block a user