Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Unpin Postgres allowing latest v14 version #11047

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d195f34
[WIP] Unpin Postgres on Windows images allowing latest v14 version.
lawrencegripper Nov 26, 2024
95b0a55
re-add signitures
lawrencegripper Nov 26, 2024
181b986
hack: get stdout and stderr for failing install
lawrencegripper Nov 27, 2024
157d0dd
Allow postgres to install necessary MSVC redistributables
lawrencegripper Nov 27, 2024
d3779e8
Merge branch 'main' into lg/postgres-win-update
lawrencegripper Nov 28, 2024
ba0b242
Update images/windows/scripts/helpers/InstallHelpers.ps1
lawrencegripper Nov 28, 2024
1acb48e
Directly install vs redist before installing postgres
lawrencegripper Nov 29, 2024
3f89591
Make install optional as probably not needed for next windows 2025 build
lawrencegripper Nov 29, 2024
a0fc3d1
debugging
lawrencegripper Dec 2, 2024
0d3756a
Handle looking for installer log before exit
lawrencegripper Dec 2, 2024
4e75669
Hack: temp fix to improve debugging loop
lawrencegripper Dec 2, 2024
692b6af
Update images/windows/scripts/helpers/InstallHelpers.ps1
lawrencegripper Dec 3, 2024
9d551e4
Missing backtick 🤦‍♂️
lawrencegripper Dec 3, 2024
1aad2d2
Update images/windows/scripts/build/Install-PostgreSQL.ps1
lawrencegripper Dec 3, 2024
66ee991
Missing recurse
lawrencegripper Dec 4, 2024
18efc23
Quicker loop again
lawrencegripper Dec 4, 2024
0fae0a3
Fix getting output
lawrencegripper Dec 4, 2024
9f19530
Put the installer back to original order
lawrencegripper Dec 4, 2024
3905577
Merge branch 'main' into lg/postgres-win-update
lawrencegripper Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using this I was able to find the issue, the installer errors with:

azure-arm.image: The database cluster will be initialized with locale "English_United States.1252".
azure-arm.image: The default text search configuration will be set to "english".
azure-arm.image:
azure-arm.image: Data page checksums are disabled.
azure-arm.image: initdb: error: could not open file "C:\Users\packer\AppData\Local\Temp/postgresql_installer_b876155f3b\rad3B194.tmp" for reading: Permission denied
azure-arm.image:
azure-arm.image: Called Die(Failed to initialise the database cluster with initdb)...
azure-arm.image: Failed to initialise the database cluster with initdb
azure-arm.image:
azure-arm.image: Script stderr:
azure-arm.image:  Program ended with an error exit code
azure-arm.image:
azure-arm.image: Error running C:\Windows\System32\cscript //NoLogo "C:\Program Files\PostgreSQL\14/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\Users\packer\AppData\Local\Temp/postgresql_installer_b876155f3b" "C:\Program Files\PostgreSQL\14" "C:\Program Files\PostgreSQL\14\data" 5432 "DEFAULT" 1: Program ended with an error exit code

https://github.com/actions/runner-images-ci/actions/runs/12159209946/job/33908835054#step:8:51246

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EBD have a test installer which may resolve, looks like it's being actively worked on at least 🤞


# 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
6 changes: 4 additions & 2 deletions images/windows/toolsets/toolset-2019.json
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,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 @@ -382,8 +382,10 @@
"version": "8.3"
},
"postgresql": {
"version": "14.12.1",
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9"
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9",
"version": "14",
"vcRedistSignature": "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D",
"installVcRedist": true
},
"kotlin": {
"version": "latest"
Expand Down
Loading