@@ -11,7 +11,7 @@ $PYTHON_REF = "https://www.python.org/ftp/python/3.13.5/python-3.13.5-amd64.exe"
1111
1212$SEVENZIP = " C:\Program Files\7-Zip\7z.exe"
1313
14- function Extract -ZipFile {
14+ function Expand -ZipFile {
1515 param (
1616 [string ]$zipFilePath ,
1717 [string ]$destinationPath
@@ -58,7 +58,7 @@ function Get-VCRedist {
5858function Get-ETCD {
5959 Write-Host " `n --- Download ETCD ---" - ForegroundColor blue
6060 Invoke-WebRequest - Uri $ETCD_REF - OutFile " $env: TEMP \etcd.zip"
61- Extract - ZipFile " $env: TEMP \etcd.zip" " $MD "
61+ Expand -ZipFile " $env: TEMP \etcd.zip" " $MD "
6262 Rename-Item " $MD \etcd-*" " etcd"
6363 Copy-Item " src\etcd.yaml" " $MD \etcd"
6464 Write-Host " `n --- ETCD downloaded ---" - ForegroundColor green
@@ -67,15 +67,15 @@ function Get-ETCD {
6767function Get-Micro {
6868 Write-Host " `n --- Download MICRO ---" - ForegroundColor blue
6969 Invoke-WebRequest - Uri $MICRO_REF - OutFile " $env: TEMP \micro.zip"
70- Extract - ZipFile " $env: TEMP \micro.zip" " $MD "
70+ Expand -ZipFile " $env: TEMP \micro.zip" " $MD "
7171 Rename-Item " $MD \micro-*" " micro"
7272 Write-Host " `n --- MICRO downloaded ---" - ForegroundColor green
7373}
7474
7575function Get-VIPManager {
7676 Write-Host " `n --- Download VIP-MANAGER ---" - ForegroundColor blue
7777 Invoke-WebRequest - Uri $VIP_REF - OutFile " $env: TEMP \vip.zip"
78- Extract - ZipFile " $env: TEMP \vip.zip" " $MD "
78+ Expand -ZipFile " $env: TEMP \vip.zip" " $MD "
7979 Rename-Item " $MD \vip-manager*" " vip-manager"
8080 Remove-Item " $MD \vip-manager\*.yml" - ErrorAction Ignore
8181 Copy-Item " src\vip.yaml" " $MD \vip-manager"
@@ -84,20 +84,20 @@ function Get-VIPManager {
8484
8585function Get-PostgreSQL {
8686 Write-Host " `n --- Download POSTGRESQL ---" - ForegroundColor blue
87- # Example: prompt for credentials if not already set
88- if (-not $PGSQL_CREDENTIAL ) {
89- $global :PGSQL_CREDENTIAL = Get-Credential - Message " Enter credentials for PostgreSQL download"
90- }
87+ # Use prompt for credentials if auth is required
88+ # if (-not $PGSQL_CREDENTIAL) {
89+ # $global:PGSQL_CREDENTIAL = Get-Credential -Message "Enter credentials for PostgreSQL download"
90+ # }
9191 Invoke-WebRequest - Uri $PGSQL_REF - OutFile " $env: TEMP \pgsql.zip" - Credential $PGSQL_CREDENTIAL
92- Extract - ZipFile " $env: TEMP \pgsql.zip" " $MD "
92+ Expand -ZipFile " $env: TEMP \pgsql.zip" " $MD "
9393 Remove-Item - Recurse - Force " $MD \pgsql\pgAdmin 4" , " $MD \pgsql\symbols" - ErrorAction Ignore
9494 Write-Host " `n --- POSTGRESQL downloaded ---" - ForegroundColor green
9595}
9696
9797function Get-Patroni {
9898 Write-Host " `n --- Download PATRONI ---" - ForegroundColor blue
9999 Invoke-WebRequest - Uri $PATRONI_REF - OutFile " $env: TEMP \patroni.zip"
100- Extract - ZipFile " $env: TEMP \patroni.zip" " $MD "
100+ Expand -ZipFile " $env: TEMP \patroni.zip" " $MD "
101101 Rename-Item " $MD \patroni-*" " patroni"
102102 Remove-Item " $MD \patroni\postgres?.yml" - ErrorAction Ignore
103103 Copy-Item " src\patroni.yaml" " $MD \patroni"
@@ -106,7 +106,30 @@ function Get-Patroni {
106106
107107function Update-PythonAndPIP {
108108 Write-Host " `n --- Update Python and PIP installation ---" - ForegroundColor blue
109- & " ./install-python.ps1"
109+ $PYTHON = " python.exe"
110+ $PIP = " pip3.exe"
111+
112+ if (-Not $env: RUNNER_TOOL_CACHE ) {
113+ Write-Host " Running on a local machine builder" - ForegroundColor Yellow
114+ $PYTHON = " $env: ProgramFiles \Python313\python.exe"
115+ $PIP = " $env: ProgramFiles \Python313\Scripts\pip3.exe"
116+ }
117+
118+ Write-Host " Loading the Python installation..." - ForegroundColor Blue
119+ Invoke-WebRequest - Uri $PYTHON_REF - OutFile " python-install.exe"
120+ Start-Process - FilePath " python-install.exe" - ArgumentList " /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 Include_launcher=0" - Wait
121+
122+ & $PYTHON - m pip install -- upgrade pip
123+
124+ Write-Host " Python version is:" - ForegroundColor Green
125+ & $PYTHON -- version
126+
127+ Write-Host " PIP version is:" - ForegroundColor Green
128+ & $PIP -- version
129+
130+ $global :PYTHON = $PYTHON
131+ $global :PIP = $PIP
132+
110133 Move-Item " python-install.exe" " $MD "
111134 Write-Host " `n --- Python and PIP installation updated ---" - ForegroundColor green
112135}
0 commit comments