Use temp script for Tower PowerShell deploy
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-07-11 11:16:09 +02:00
parent f69f246065
commit 3e220f10d3
4 changed files with 40 additions and 11 deletions
+32 -5
View File
@@ -58,10 +58,37 @@ if [ -x scripts/verify_browser_runtime.sh ]; then
fi
'@
$remoteCommand = "REMOTE_PATH='$RemotePath' REMOTE_BRANCH='$RemoteBranch' REMOTE_REPO='$RemoteRepo' FRONTEND_URL='$FrontendUrl' DEPLOY_BOOTSTRAP='$bootstrapValue' DEPLOY_GEOINTEL_INSTALL_AI='$InstallAi' bash -s"
$utf8NoBom = [System.Text.UTF8Encoding]::new($false)
[Console]::OutputEncoding = $utf8NoBom
$OutputEncoding = $utf8NoBom
$localScriptPath = [System.IO.Path]::GetTempFileName()
$remoteScriptPath = "/tmp/geointel-deploy-$([System.Guid]::NewGuid().ToString('N')).sh"
$remoteScript | ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -i $SshKey $RemoteHost $remoteCommand
try {
[System.IO.File]::WriteAllText($localScriptPath, $remoteScript, $utf8NoBom)
$scpArgs = @(
"-o", "BatchMode=yes",
"-o", "StrictHostKeyChecking=accept-new",
"-i", $SshKey,
$localScriptPath,
"${RemoteHost}:$remoteScriptPath"
)
& scp @scpArgs
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
$remoteRunCommand = "REMOTE_PATH='$RemotePath' REMOTE_BRANCH='$RemoteBranch' REMOTE_REPO='$RemoteRepo' FRONTEND_URL='$FrontendUrl' DEPLOY_BOOTSTRAP='$bootstrapValue' DEPLOY_GEOINTEL_INSTALL_AI='$InstallAi' bash '$remoteScriptPath'; status=`$?; rm -f '$remoteScriptPath'; exit `$status"
$sshRunArgs = @(
"-o", "BatchMode=yes",
"-o", "StrictHostKeyChecking=accept-new",
"-i", $SshKey,
$RemoteHost,
$remoteRunCommand
)
& ssh @sshRunArgs
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
} finally {
Remove-Item -LiteralPath $localScriptPath -Force -ErrorAction SilentlyContinue
}