Skip to content

Commit 5fca969

Browse files
baasith6cursoragent
andcommitted
Fix Jenkins installer build: resolve Python path for service account.
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent eee7cb1 commit 5fca969

5 files changed

Lines changed: 51 additions & 12 deletions

File tree

Jenkinsfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pipeline {
1212

1313
environment {
1414
VM_APP_DIR = '/opt/onevo/app'
15+
ONEVO_PYTHON = 'C:\\Users\\Abdul Baasith\\AppData\\Local\\Python\\bin\\python.exe'
1516
}
1617

1718
stages {
@@ -37,8 +38,8 @@ pipeline {
3738
stage('Connector tests') {
3839
steps {
3940
dir('connector') {
40-
bat '"C:\\Users\\Abdul Baasith\\AppData\\Local\\Python\\bin\\python.exe" -m pip install -r requirements.txt pytest'
41-
bat 'set PYTHONPATH=.&& "C:\\Users\\Abdul Baasith\\AppData\\Local\\Python\\bin\\python.exe" -m pytest tests/ -q'
41+
bat '"%ONEVO_PYTHON%" -m pip install -r requirements.txt pytest'
42+
bat 'set PYTHONPATH=.&& "%ONEVO_PYTHON%" -m pytest tests/ -q'
4243
}
4344
}
4445
}
@@ -61,6 +62,7 @@ pipeline {
6162
-VmHost ${params.VM_HOST} ^
6263
-VmUser ${params.VM_USER} ^
6364
-BackendUrl ${params.BACKEND_URL} ^
65+
-PythonPath "%ONEVO_PYTHON%" ^
6466
-SshKeyPath "${env.SSH_KEY}"${extra}
6567
"""
6668
}

connector/installer/build.ps1

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
param(
33
[Parameter(Mandatory = $true)]
44
[string]$BackendUrl,
5+
[string]$PythonPath = "",
56
[switch]$AllowHttp
67
)
78

@@ -36,6 +37,36 @@ function Find-ISCC {
3637
return ($candidates | Select-Object -First 1)
3738
}
3839

40+
function Find-Python([string]$ExplicitPath) {
41+
$candidates = @(
42+
$ExplicitPath,
43+
$env:ONEVO_PYTHON,
44+
$env:PYTHON_EXE,
45+
(Get-Command python -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source),
46+
"$env:LOCALAPPDATA\Python\bin\python.exe",
47+
"$env:LOCALAPPDATA\Programs\Python\Python314\python.exe",
48+
"$env:LOCALAPPDATA\Programs\Python\Python313\python.exe",
49+
"$env:LOCALAPPDATA\Programs\Python\Python312\python.exe",
50+
"$env:LOCALAPPDATA\Programs\Python\Python311\python.exe"
51+
)
52+
$userRoots = Get-ChildItem 'C:\Users' -Directory -ErrorAction SilentlyContinue |
53+
Where-Object { $_.Name -notin @('Public', 'Default', 'Default User', 'All Users') }
54+
foreach ($user in $userRoots) {
55+
$candidates += @(
56+
(Join-Path $user.FullName 'AppData\Local\Python\bin\python.exe'),
57+
(Join-Path $user.FullName 'AppData\Local\Programs\Python\Python314\python.exe'),
58+
(Join-Path $user.FullName 'AppData\Local\Programs\Python\Python313\python.exe'),
59+
(Join-Path $user.FullName 'AppData\Local\Programs\Python\Python312\python.exe'),
60+
(Join-Path $user.FullName 'AppData\Local\Programs\Python\Python311\python.exe')
61+
)
62+
}
63+
$found = $candidates | Where-Object { $_ -and (Test-Path $_) } | Select-Object -First 1
64+
if (-not $found) {
65+
throw "Python was not found. Set ONEVO_PYTHON or install Python 3.11+ and add it to PATH."
66+
}
67+
return $found
68+
}
69+
3970
$BackendUrl = Assert-BackendUrl $BackendUrl $AllowHttp.IsPresent
4071
Write-Host "==> BackendUrl (baked): $BackendUrl"
4172

@@ -51,8 +82,8 @@ try {
5182
throw "Invalid WinSW XML ($WinSwConfig): $($_.Exception.Message)"
5283
}
5384

54-
$py = Get-Command python -ErrorAction SilentlyContinue
55-
if (-not $py) { throw "Python was not found on PATH" }
85+
$python = Find-Python $PythonPath
86+
Write-Host "==> Python: $python"
5687

5788
$baked = @"
5889
# AUTO-GENERATED by installer/build.ps1 - do not edit by hand.
@@ -66,10 +97,13 @@ New-Item -ItemType Directory -Force -Path $DistDir | Out-Null
6697
$pyinstallerOut = Join-Path $DistDir "onevo-connector.exe"
6798
if (Test-Path $pyinstallerOut) { Remove-Item $pyinstallerOut -Force }
6899

100+
Write-Host "==> PyInstaller deps..."
101+
& $python -m pip install -q -r (Join-Path $ConnectorRoot "requirements.txt") -r (Join-Path $ConnectorRoot "requirements-build.txt")
102+
69103
Write-Host "==> PyInstaller..."
70104
Push-Location $ConnectorRoot
71105
try {
72-
& python -m PyInstaller --noconfirm --clean --distpath $DistDir --workpath (Join-Path $DistDir "build") $SpecFile
106+
& $python -m PyInstaller --noconfirm --clean --distpath $DistDir --workpath (Join-Path $DistDir "build") $SpecFile
73107
if ($LASTEXITCODE -ne 0) {
74108
throw "PyInstaller build failed (exit $LASTEXITCODE). Ensure pip install -r requirements-build.txt was run."
75109
}

docs/JENKINS_DEPLOY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Deploy ONEVO to the Azure MVP VM from your local Windows PC using the root [`Jen
1212

1313
1. [Jenkins LTS](https://www.jenkins.io/download/) installed on Windows.
1414
2. **Git** and **OpenSSH client** (Windows 10+ optional feature or Git for Windows).
15-
3. **.NET 8 SDK**, **Node.js 20**, **Python 3.11+** on the Jenkins agent (same PC).
15+
3. **.NET 8 SDK**, **Node.js 20**, **Python 3.11+** on the Jenkins agent (same PC). Set `ONEVO_PYTHON` in the Jenkinsfile to your Python exe — Jenkins service account often has no `python` on PATH.
1616
4. **Inno Setup 6** + PyInstaller deps for connector installer (see [`connector/installer/INSTALL.md`](../connector/installer/INSTALL.md)).
1717
5. SSH private key that can log in as `azureuser@20.193.69.220`. On Windows OpenSSH, use your **RSA** key (`id_rsa`) in Jenkins — explicit `-i` with `id_ed25519` often fails even when plain `ssh` works.
1818

scripts/build-installer.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
param(
33
[Parameter(Mandatory = $true)]
44
[string]$BackendUrl,
5+
[string]$PythonPath = "",
56
[switch]$AllowHttp
67
)
78

@@ -14,11 +15,10 @@ if (-not (Test-Path $buildScript)) {
1415
}
1516

1617
Write-Host "Building ONEVO connector installer for $BackendUrl ..."
17-
if ($AllowHttp) {
18-
& $buildScript -BackendUrl $BackendUrl -AllowHttp
19-
} else {
20-
& $buildScript -BackendUrl $BackendUrl
21-
}
18+
$buildArgs = @{ BackendUrl = $BackendUrl }
19+
if ($PythonPath) { $buildArgs.PythonPath = $PythonPath }
20+
if ($AllowHttp) { $buildArgs.AllowHttp = $true }
21+
& $buildScript @buildArgs
2222

2323
$dist = Join-Path $root "connector\dist"
2424
Get-ChildItem $dist -Filter "ONEVO-Connector-Setup-*.exe" | ForEach-Object {

scripts/deploy-vm.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ param(
55
[string]$VmAppDir = "/opt/onevo/app",
66
[string]$BackendUrl = "http://20.193.69.220:8081",
77
[string]$SshKeyPath = "",
8+
[string]$PythonPath = "",
89
[switch]$SkipInstaller,
910
[switch]$SkipBuild,
1011
[switch]$UseGpu
@@ -81,7 +82,9 @@ if (-not $SkipInstaller) {
8182
Write-Host "==> Ensuring installer tools (ffmpeg, WinSW)..."
8283
& (Join-Path $root "scripts\ensure-installer-tools.ps1")
8384
Write-Host "==> Building Windows installer..."
84-
& (Join-Path $root "scripts\build-installer.ps1") -BackendUrl $BackendUrl -AllowHttp
85+
$installerArgs = @{ BackendUrl = $BackendUrl; AllowHttp = $true }
86+
if ($PythonPath) { $installerArgs.PythonPath = $PythonPath }
87+
& (Join-Path $root "scripts\build-installer.ps1") @installerArgs
8588
$installerExe = Get-ChildItem (Join-Path $root "connector\dist\ONEVO-Connector-Setup-*.exe") |
8689
Sort-Object LastWriteTime -Descending | Select-Object -First 1
8790
if (-not $installerExe) { throw "Installer EXE not found after build" }

0 commit comments

Comments
 (0)