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:
gti
2026-09-24 10:17:47 -03:00
co-authored by Claude Sonnet 5
parent b01e3b230a
commit 7080ef4d73
3 changed files with 117 additions and 5 deletions
+19 -1
View File
@@ -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