Skip to content

Commit

Permalink
Merge pull request #11047 from lawrencegripper/lg/postgres-win-update
Browse files Browse the repository at this point in the history
[Windows] Unpin Postgres allowing latest v14 version
  • Loading branch information
lawrencegripper authored Jan 21, 2025
2 parents c21e396 + ddaec57 commit 6020692
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
13 changes: 12 additions & 1 deletion images/windows/scripts/build/Install-PostgreSQL.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,24 @@ if ($null -ne ($toolsetVersion | Select-String -Pattern '\d+\.\d+\.\d+')) {
} while (!$response)
}

if ((Get-ToolsetContent).postgresql.installVcRedist) {
# Postgres 14 requires the vs 17 redistributable
$vs17RedistUrl = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
Install-Binary `
-Url $vs17RedistUrl `
-InstallArgs @("/install", "/quiet", "/norestart") `
-ExpectedSignature (Get-ToolsetContent).postgresql.vcRedistSignature
}

# Return the previous value of ErrorAction and invoke Install-Binary function
$ErrorActionPreference = $errorActionOldValue
$installerArgs = @("--install_runtimes 0", "--superpassword root", "--enable_acledit 1", "--unattendedmodeui none", "--mode unattended")

Install-Binary `
-Url $installerUrl `
-InstallArgs $installerArgs `
-ExpectedSignature (Get-ToolsetContent).postgresql.signature
-ExpectedSignature (Get-ToolsetContent).postgresql.signature `
-InstallerLogPath "$env:TEMP\**\install-postgresql.log"

# Get Path to pg_ctl.exe
$pgPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName
Expand Down
16 changes: 15 additions & 1 deletion images/windows/scripts/helpers/InstallHelpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ function Install-Binary {
.PARAMETER ExpectedSHA512Sum
The expected SHA512 sum of the binary. If specified, the binary's SHA512 sum is checked before installation.
.PARAMETER InstallerLogPath
The path to the log file which is produced when the installation fails. This can be used for debugging purposes.
This is only displayed when the installation fails.
.EXAMPLE
Install-Binary -Url "https://go.microsoft.com/fwlink/p/?linkid=2083338" -Type EXE -InstallArgs ("/features", "+", "/quiet") -ExpectedSignature "A5C7D5B7C838D5F89DDBEDB85B2C566B4CDA881F"
#>
Expand All @@ -46,7 +50,8 @@ function Install-Binary {
[String[]] $ExtraInstallArgs,
[String[]] $ExpectedSignature,
[String] $ExpectedSHA256Sum,
[String] $ExpectedSHA512Sum
[String] $ExpectedSHA512Sum,
[String] $InstallerLogPath
)

if ($PSCmdlet.ParameterSetName -eq "LocalPath") {
Expand Down Expand Up @@ -122,6 +127,15 @@ function Install-Binary {
} else {
Write-Host "Installation process returned unexpected exit code: $exitCode"
Write-Host "Time elapsed: $installCompleteTime seconds"

if ($InstallerLogPath) {
Write-Host "Searching for logs maching $InstallerLogPath pattern"
Get-ChildItem -Recurse -Path $InstallerLogPath | ForEach-Object {
Write-Output "Found Installer Log: $InstallerLogPath"
Write-Output "File content:"
Get-Content -Path $_.FullName
}
}
exit $exitCode
}
} catch {
Expand Down
8 changes: 5 additions & 3 deletions images/windows/toolsets/toolset-2019.json
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@
"choco": {
"common_packages": [
{ "name": "7zip.install" },
{ "name": "aria2" },
{ "name": "azcopy10" },
{ "name": "aria2" },
{ "name": "Bicep" },
{ "name": "gitversion.portable"},
{ "name": "innosetup" },
Expand Down Expand Up @@ -462,8 +462,10 @@
"version": "18"
},
"postgresql": {
"version": "14.12.1",
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9"
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9",
"version": "14",
"vcRedistSignature": "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D",
"installVcRedist": true
},
"kotlin": {
"version": "latest"
Expand Down
6 changes: 4 additions & 2 deletions images/windows/toolsets/toolset-2022.json
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,10 @@
"version": "8.3"
},
"postgresql": {
"version": "14.12.1",
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9"
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9",
"version": "14",
"vcRedistSignature": "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D",
"installVcRedist": true
},
"kotlin": {
"version": "latest"
Expand Down

0 comments on commit 6020692

Please sign in to comment.