Skip to content

Commit 2040a4b

Browse files
Fix path to python for windows VM
1 parent 4e34ed1 commit 2040a4b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

scripts/bash/deploy_arc_ring.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ $envBytes = [System.Convert]::FromBase64String($EnvContentB64)
8989
$envContent = [System.Text.Encoding]::UTF8.GetString($envBytes)
9090
[System.IO.File]::WriteAllText("$Base\.env", $envContent, [System.Text.Encoding]::UTF8)
9191
Write-Output "Written .env to $Base"
92+
# Refresh PATH from registry and add the Chocolatey Python install path explicitly.
93+
# Arc Run Command runs as SYSTEM whose PATH may not include Python even after install,
94+
# because Chocolatey adds it to the installing user's PATH, not SYSTEM's.
95+
# Child processes (deploy.ps1) inherit this updated PATH.
96+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" +
97+
[System.Environment]::GetEnvironmentVariable("Path", "User")
98+
$pyMajorMinor = (($PythonVersion -split '\.')[0..1]) -join ''
99+
$pyPath = "C:\Python$pyMajorMinor"
100+
if (Test-Path $pyPath) { $env:Path += ";$pyPath" }
92101
$dst = "$env:TEMP\deploy.ps1"
93102
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/NHSDigital/manage-breast-screening-gateway/$ReleaseTag/scripts/powershell/deploy.ps1" -OutFile $dst -UseBasicParsing
94103
Write-Output "Downloaded deploy.ps1"

0 commit comments

Comments
 (0)