Initial public release
GeoIntel release gates / Compile, test, contracts and builds (push) Successful in 1m49s
GeoIntel release gates / Python and npm vulnerability policy (push) Successful in 21s
GeoIntel release gates / Production AI image, SBOM and container scan (push) Successful in 5m39s
GeoIntel release gates / Deploy exact gated revision to Unraid (push) Failing after 58m43s
GeoIntel release gates / Compile, test, contracts and builds (push) Successful in 1m49s
GeoIntel release gates / Python and npm vulnerability policy (push) Successful in 21s
GeoIntel release gates / Production AI image, SBOM and container scan (push) Successful in 5m39s
GeoIntel release gates / Deploy exact gated revision to Unraid (push) Failing after 58m43s
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
param(
|
||||
[string]$RemoteHost = "root@192.0.2.10",
|
||||
[string]$RemotePath = "/mnt/user/appdata/geointel",
|
||||
[string]$RemoteBranch = "main",
|
||||
[string]$RemoteRepo = "gitea-widefrog:Jens/geointel.git",
|
||||
[string]$SshKey = "$HOME/.ssh/geointel_unraid_deploy",
|
||||
[string]$FrontendUrl = "http://192.0.2.10:1202",
|
||||
[string]$InstallAi = $(if ($env:GEOINTEL_INSTALL_AI) { $env:GEOINTEL_INSTALL_AI } else { "" }),
|
||||
[switch]$Bootstrap
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$bootstrapValue = if ($Bootstrap) { "1" } else { "0" }
|
||||
|
||||
$remoteScript = @'
|
||||
set -euo pipefail
|
||||
git config --global --add safe.directory "$REMOTE_PATH"
|
||||
cd "$REMOTE_PATH"
|
||||
|
||||
if [ ! -d .git ]; then
|
||||
if [ "$DEPLOY_BOOTSTRAP" != '1' ]; then
|
||||
echo "No git checkout found in $REMOTE_PATH."
|
||||
echo 'Re-run with -Bootstrap for the first deployment bootstrap.'
|
||||
exit 2
|
||||
fi
|
||||
git init
|
||||
git remote add origin "$REMOTE_REPO"
|
||||
fi
|
||||
|
||||
if git remote get-url origin >/dev/null 2>&1; then
|
||||
git remote set-url origin "$REMOTE_REPO"
|
||||
else
|
||||
git remote add origin "$REMOTE_REPO"
|
||||
fi
|
||||
git fetch origin "$REMOTE_BRANCH"
|
||||
git reset --hard "origin/$REMOTE_BRANCH"
|
||||
git branch -M "$REMOTE_BRANCH"
|
||||
# Remove only untracked source files that can enter the image. Persistent
|
||||
# runtime roots (.env, storage, models and postgres-data) are deliberately not
|
||||
# in this scoped clean list.
|
||||
git clean -fd -- backend frontend deploy scripts fixtures tests contracts demo
|
||||
chmod +x scripts/*.sh backend/docker_start.sh deploy/unraid/*.sh || true
|
||||
|
||||
# Persistent runtime roots can legitimately contain untracked files. The
|
||||
# deploy checkout nevertheless has an exact, freshly fetched source revision
|
||||
# because every image-bearing source path was reset and cleaned above.
|
||||
DEPLOY_BUILD_SHA="$(git rev-parse HEAD)"
|
||||
|
||||
GEOINTEL_BUILD_SHA="$DEPLOY_BUILD_SHA" \
|
||||
FRONTEND_URL="$FRONTEND_URL" \
|
||||
DEPLOY_GEOINTEL_INSTALL_AI="${DEPLOY_GEOINTEL_INSTALL_AI:-}" \
|
||||
bash deploy/unraid/deploy-release.sh
|
||||
'@
|
||||
|
||||
$utf8NoBom = [System.Text.UTF8Encoding]::new($false)
|
||||
$localScriptPath = [System.IO.Path]::GetTempFileName()
|
||||
$remoteScriptPath = "/tmp/geointel-deploy-$([System.Guid]::NewGuid().ToString('N')).sh"
|
||||
|
||||
try {
|
||||
$remoteScriptLf = $remoteScript -replace "`r`n", "`n"
|
||||
[System.IO.File]::WriteAllText($localScriptPath, $remoteScriptLf, $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
|
||||
}
|
||||
Reference in New Issue
Block a user