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

Conversation

lawrencegripper
Copy link

@lawrencegripper lawrencegripper commented Nov 26, 2024

Description

New tool, Bug fixing, or Improvement?

  • Version update

Please include a summary of the change and which issue is fixed. Also include relevant motivation and context.

  • Currently patch version of postgres is pinned on Windows. This removes that pin to allow the latest minor version of v14 to be installed.

For new tools, please provide total size and installation time.

Related issue:

Check list

  • Related issue / work item is attached
  • Tests are written (if applicable)
  • Documentation is updated (if applicable)
  • Changes are tested and related VM images are successfully generated

removed these by accident, postgres releases are
signed with same key so keeping this allows us
to validate it
@lawrencegripper lawrencegripper changed the title [WIP] Unpin Postgres on Windows images allowing latest v14 version. [Windows] Unpin Postgres allowing latest v14 version Nov 26, 2024
@lawrencegripper
Copy link
Author

Hitting this when running the CI. Having a look at debugging now.

==> azure-arm.image: Provisioning with powershell script: /home/runner/work/runner-images-ci/runner-images-ci/images/windows/templates/../scripts/build/Install-PostgreSQL.ps1
    azure-arm.image: Downloading package from https://get.enterprisedb.com/postgresql/postgresql-14.15-1-windows-x64.exe to C:\Users\packer\AppData\Local\Temp\postgresql-14.15-1-windows-x64.exe...
    azure-arm.image: Package downloaded in 1.27 seconds
    azure-arm.image: Signature for C:\Users\packer\AppData\Local\Temp\postgresql-14.15-1-windows-x64.exe is valid
    azure-arm.image: Starting Install ...
    azure-arm.image: Installation process returned unexpected exit code: 1
    azure-arm.image: Time elapsed: 141.61 seconds

@lawrencegripper
Copy link
Author

lawrencegripper commented Nov 27, 2024

With a local Windows box I can reproduce this error.

I get:

There has been an error. Error running ...\getlocales.exe : child killed: unknown signal

Searching this maps to the issue seen here

https://stackoverflow.com/questions/71790488/postgresql-error-running-c-getlocales-exe-child-killed-unknown-signal

Running postgres.exe --help shows that --install-runtimes 0 skips installing the necessary MSVC Redistributable which the installer needs.

Testing locally, with that param removed the installation goes ahead

screenshot-2024-11-27-15-57-24

I think this worked with previous versions as they used aka.ms/vs/17/release/vc_redist.x64.exe which is installed by out Install-VisualStudio.ps1 command here:

https://github.com/lawrencegripper/runner-images/blob/181b98660dd23f8de32e6cb068d261e98b6bdad0/images/windows/templates/windows-2019.pkr.hcl#L388

https://github.com/lawrencegripper/runner-images/blob/181b98660dd23f8de32e6cb068d261e98b6bdad0/images/windows/scripts/helpers/VisualStudioHelpers.ps1#L35

As that that provisioner is invoked before postgres the MSVC Redistributable was present when we got to installing postgres.

Now that postgres needs MSVC 17 that is no longer the case.

I've removed the --install_runtimes 0 from the postgres install so it'll add MSVC 17 and in future auto add newer ones as it requires them.

Newer postgres installes require MSVC 17 which isn't
on the box by default.

Previously this worked as they required MSVC 16
which was installed by Visual Studio

actions#11047 (comment)
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 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants