mirror of
https://github.com/actions/runner-images.git
synced 2025-12-16 06:40:32 +00:00
PostgreSQL: Remove from PATH/Add environment variables. (#1099)
* Removed PostgreSQL server from path. * Added new Paths * added another solution for documentation * Fixed path in generator.
This commit is contained in:
@@ -9,11 +9,17 @@ Set-SystemVariable -SystemVariable PGUSER -Value $pgUser
|
|||||||
Set-SystemVariable -SystemVariable PGPASSWORD -Value $pgPwd
|
Set-SystemVariable -SystemVariable PGPASSWORD -Value $pgPwd
|
||||||
|
|
||||||
#Install latest PostgreSQL
|
#Install latest PostgreSQL
|
||||||
Choco-Install -PackageName postgresql -ArgumentList "--params", "/Password:$pgPwd", "--params-global", "--debug", "--verbose"
|
Choco-Install -PackageName postgresql -ArgumentList "--params", "/Password:$pgPwd", "/NoPath", "--params-global", "--debug", "--verbose"
|
||||||
|
|
||||||
#Get Path to pg_ctl.exe
|
#Get Path to pg_ctl.exe
|
||||||
$pgPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName
|
$pgPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName
|
||||||
|
|
||||||
#Parse output of command above to obtain pure path
|
#Parse output of command above to obtain pure path
|
||||||
$pgBin = Split-Path -Path $pgPath.split('"')[1]
|
$pgBin = Split-Path -Path $pgPath.split('"')[1]
|
||||||
#Added PostgreSQL bin path into PATH variable
|
$pgRoot = Split-Path -Path $pgPath.split('"')[5]
|
||||||
Add-MachinePathItem $pgBin
|
$pgData = Join-Path $pgRoot "data"
|
||||||
|
|
||||||
|
#Added PostgreSQL environment variable
|
||||||
|
Set-SystemVariable -SystemVariable PGBIN -Value $pgBin
|
||||||
|
Set-SystemVariable -SystemVariable PGROOT -Value $pgRoot
|
||||||
|
Set-SystemVariable -SystemVariable PGDATA -Value $pgData
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
$pgReady = Start-Process -FilePath pg_isready -Wait -PassThru
|
$pgReadyPath = Join-Path $PGBIN "pg_isready.exe"
|
||||||
|
$pgReady = Start-Process -FilePath $pgReadyPath -Wait -PassThru
|
||||||
$exitCode = $pgReady.ExitCode
|
$exitCode = $pgReady.ExitCode
|
||||||
|
|
||||||
if ($exitCode -eq 0)
|
if ($exitCode -eq 0)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ function Get-PostgreSQLMarkdown
|
|||||||
Version = $pgVersion
|
Version = $pgVersion
|
||||||
UserName = $env:PGUSER
|
UserName = $env:PGUSER
|
||||||
Password = $env:PGPASSWORD
|
Password = $env:PGPASSWORD
|
||||||
|
EnvironmentVariables = "PGBIN=$env:PGBIN; <br> PGDATA=$env:PGDATA; <br> PGROOT=$env:PGROOT"
|
||||||
Path = $pgRoot
|
Path = $pgRoot
|
||||||
ServiceName = $pgService.Name
|
ServiceName = $pgService.Name
|
||||||
ServiceStatus = $pgService.State
|
ServiceStatus = $pgService.State
|
||||||
|
|||||||
Reference in New Issue
Block a user