From d195f34aa8bb2ff6003beaee490aad50bfb5f28e Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Tue, 26 Nov 2024 10:29:31 +0000 Subject: [PATCH 01/20] [WIP] Unpin Postgres on Windows images allowing latest v14 version. --- images/windows/toolsets/toolset-2019.json | 3 +-- images/windows/toolsets/toolset-2022.json | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/images/windows/toolsets/toolset-2019.json b/images/windows/toolsets/toolset-2019.json index 446e652c4..262f18aba 100644 --- a/images/windows/toolsets/toolset-2019.json +++ b/images/windows/toolsets/toolset-2019.json @@ -472,8 +472,7 @@ "version": "18" }, "postgresql": { - "version": "14.12.1", - "signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9" + "version": "14" }, "kotlin": { "version": "latest" diff --git a/images/windows/toolsets/toolset-2022.json b/images/windows/toolsets/toolset-2022.json index 7067b0c89..5eceac839 100644 --- a/images/windows/toolsets/toolset-2022.json +++ b/images/windows/toolsets/toolset-2022.json @@ -381,8 +381,7 @@ "version": "8.3" }, "postgresql": { - "version": "14.12.1", - "signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9" + "version": "14" }, "kotlin": { "version": "latest" From 95b0a5551b43e67b8d3f816223c235a8f6b1075e Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Tue, 26 Nov 2024 13:33:25 +0000 Subject: [PATCH 02/20] re-add signitures removed these by accident, postgres releases are signed with same key so keeping this allows us to validate it --- images/windows/toolsets/toolset-2019.json | 1 + images/windows/toolsets/toolset-2022.json | 1 + 2 files changed, 2 insertions(+) diff --git a/images/windows/toolsets/toolset-2019.json b/images/windows/toolsets/toolset-2019.json index 262f18aba..960e5146d 100644 --- a/images/windows/toolsets/toolset-2019.json +++ b/images/windows/toolsets/toolset-2019.json @@ -472,6 +472,7 @@ "version": "18" }, "postgresql": { + "signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9", "version": "14" }, "kotlin": { diff --git a/images/windows/toolsets/toolset-2022.json b/images/windows/toolsets/toolset-2022.json index 5eceac839..1e5c75333 100644 --- a/images/windows/toolsets/toolset-2022.json +++ b/images/windows/toolsets/toolset-2022.json @@ -381,6 +381,7 @@ "version": "8.3" }, "postgresql": { + "signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9", "version": "14" }, "kotlin": { From 181b98660dd23f8de32e6cb068d261e98b6bdad0 Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Wed, 27 Nov 2024 10:57:26 +0000 Subject: [PATCH 03/20] hack: get stdout and stderr for failing install --- images/windows/scripts/helpers/InstallHelpers.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/images/windows/scripts/helpers/InstallHelpers.ps1 b/images/windows/scripts/helpers/InstallHelpers.ps1 index 139d51b38..b27831386 100644 --- a/images/windows/scripts/helpers/InstallHelpers.ps1 +++ b/images/windows/scripts/helpers/InstallHelpers.ps1 @@ -121,6 +121,10 @@ function Install-Binary { Write-Host "Installation successful in $installCompleteTime seconds. Reboot is required." } else { Write-Host "Installation process returned unexpected exit code: $exitCode" + Write-Host "Standard Output:" + Write-Host $process.StandardOutput.ReadToEnd() + Write-Host "Standard Error:" + Write-Host $process.StandardError.ReadToEnd() Write-Host "Time elapsed: $installCompleteTime seconds" exit $exitCode } From 157d0dd46ba3ca0b4a28e80c7aabdbdcc715317b Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Wed, 27 Nov 2024 16:03:13 +0000 Subject: [PATCH 04/20] Allow postgres to install necessary MSVC redistributables 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 https://github.com/actions/runner-images/pull/11047#issuecomment-2504219995 --- images/windows/scripts/build/Install-PostgreSQL.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/windows/scripts/build/Install-PostgreSQL.ps1 b/images/windows/scripts/build/Install-PostgreSQL.ps1 index 2bad88580..a43b5da55 100644 --- a/images/windows/scripts/build/Install-PostgreSQL.ps1 +++ b/images/windows/scripts/build/Install-PostgreSQL.ps1 @@ -60,7 +60,7 @@ if ($null -ne ($toolsetVersion | Select-String -Pattern '\d+\.\d+\.\d+')) { # 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") +$installerArgs = @("--superpassword root", "--enable_acledit 1", "--unattendedmodeui none", "--mode unattended") Install-Binary ` -Url $installerUrl ` -InstallArgs $installerArgs ` From ba0b2425036cb6d67b7e8fdd0dc91dd60a643398 Mon Sep 17 00:00:00 2001 From: Lawrence Gripper Date: Thu, 28 Nov 2024 15:42:57 +0000 Subject: [PATCH 05/20] Update images/windows/scripts/helpers/InstallHelpers.ps1 --- images/windows/scripts/helpers/InstallHelpers.ps1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/images/windows/scripts/helpers/InstallHelpers.ps1 b/images/windows/scripts/helpers/InstallHelpers.ps1 index 94db7b841..b491533e4 100644 --- a/images/windows/scripts/helpers/InstallHelpers.ps1 +++ b/images/windows/scripts/helpers/InstallHelpers.ps1 @@ -121,10 +121,6 @@ function Install-Binary { Write-Host "Installation successful in $installCompleteTime seconds. Reboot is required." } else { Write-Host "Installation process returned unexpected exit code: $exitCode" - Write-Host "Standard Output:" - Write-Host $process.StandardOutput.ReadToEnd() - Write-Host "Standard Error:" - Write-Host $process.StandardError.ReadToEnd() Write-Host "Time elapsed: $installCompleteTime seconds" exit $exitCode } From 1acb48ed45cda5f2e12af1cf1f79eed7e33f287e Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Fri, 29 Nov 2024 10:23:46 +0000 Subject: [PATCH 06/20] Directly install vs redist before installing postgres --- images/windows/scripts/build/Install-PostgreSQL.ps1 | 9 ++++++++- images/windows/toolsets/toolset-2019.json | 3 ++- images/windows/toolsets/toolset-2022.json | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/images/windows/scripts/build/Install-PostgreSQL.ps1 b/images/windows/scripts/build/Install-PostgreSQL.ps1 index a43b5da55..561325d5e 100644 --- a/images/windows/scripts/build/Install-PostgreSQL.ps1 +++ b/images/windows/scripts/build/Install-PostgreSQL.ps1 @@ -58,9 +58,16 @@ if ($null -ne ($toolsetVersion | Select-String -Pattern '\d+\.\d+\.\d+')) { } while (!$response) } +# 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 = @("--superpassword root", "--enable_acledit 1", "--unattendedmodeui none", "--mode unattended") +$installerArgs = @("--install_runtimes 0", "--superpassword root", "--enable_acledit 1", "--unattendedmodeui none", "--mode unattended") Install-Binary ` -Url $installerUrl ` -InstallArgs $installerArgs ` diff --git a/images/windows/toolsets/toolset-2019.json b/images/windows/toolsets/toolset-2019.json index 960e5146d..e192ede5e 100644 --- a/images/windows/toolsets/toolset-2019.json +++ b/images/windows/toolsets/toolset-2019.json @@ -473,7 +473,8 @@ }, "postgresql": { "signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9", - "version": "14" + "version": "14", + "vcRedistSignature": "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D" }, "kotlin": { "version": "latest" diff --git a/images/windows/toolsets/toolset-2022.json b/images/windows/toolsets/toolset-2022.json index 23afa8b71..ff60ff32e 100644 --- a/images/windows/toolsets/toolset-2022.json +++ b/images/windows/toolsets/toolset-2022.json @@ -382,7 +382,8 @@ }, "postgresql": { "signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9", - "version": "14" + "version": "14", + "vcRedistSignature": "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D" }, "kotlin": { "version": "latest" From 3f89591af505f0d8a2d193a547fe0b632e0e0817 Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Fri, 29 Nov 2024 11:01:49 +0000 Subject: [PATCH 07/20] Make install optional as probably not needed for next windows 2025 build --- .../windows/scripts/build/Install-PostgreSQL.ps1 | 14 ++++++++------ images/windows/toolsets/toolset-2019.json | 3 ++- images/windows/toolsets/toolset-2022.json | 3 ++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/images/windows/scripts/build/Install-PostgreSQL.ps1 b/images/windows/scripts/build/Install-PostgreSQL.ps1 index 561325d5e..50fdcf708 100644 --- a/images/windows/scripts/build/Install-PostgreSQL.ps1 +++ b/images/windows/scripts/build/Install-PostgreSQL.ps1 @@ -58,12 +58,14 @@ if ($null -ne ($toolsetVersion | Select-String -Pattern '\d+\.\d+\.\d+')) { } while (!$response) } -# 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 +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 diff --git a/images/windows/toolsets/toolset-2019.json b/images/windows/toolsets/toolset-2019.json index e192ede5e..9f139a4b1 100644 --- a/images/windows/toolsets/toolset-2019.json +++ b/images/windows/toolsets/toolset-2019.json @@ -474,7 +474,8 @@ "postgresql": { "signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9", "version": "14", - "vcRedistSignature": "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D" + "vcRedistSignature": "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D", + "installVcRedist": true }, "kotlin": { "version": "latest" diff --git a/images/windows/toolsets/toolset-2022.json b/images/windows/toolsets/toolset-2022.json index ff60ff32e..44d851983 100644 --- a/images/windows/toolsets/toolset-2022.json +++ b/images/windows/toolsets/toolset-2022.json @@ -383,7 +383,8 @@ "postgresql": { "signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9", "version": "14", - "vcRedistSignature": "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D" + "vcRedistSignature": "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D", + "installVcRedist": true }, "kotlin": { "version": "latest" From a0fc3d11c57b350472e24c267c497f451349bad8 Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Mon, 2 Dec 2024 10:14:52 +0000 Subject: [PATCH 08/20] debugging --- .../scripts/build/Install-PostgreSQL.ps1 | 44 +++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/images/windows/scripts/build/Install-PostgreSQL.ps1 b/images/windows/scripts/build/Install-PostgreSQL.ps1 index 50fdcf708..920600f36 100644 --- a/images/windows/scripts/build/Install-PostgreSQL.ps1 +++ b/images/windows/scripts/build/Install-PostgreSQL.ps1 @@ -70,10 +70,46 @@ if ((Get-ToolsetContent).postgresql.installVcRedist) { # 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 +try { + Install-Binary ` + -Url $installerUrl ` + -InstallArgs $installerArgs ` + -ExpectedSignature (Get-ToolsetContent).postgresql.signature +} catch { + # Recursively search for install-postgres.log + $installPostgresLog = Get-ChildItem -Path $env:TEMP -Recurse -Filter "install-postgresql.log" -ErrorAction SilentlyContinue | Select-Object -First 1 + + if ($installPostgresLog) { + Write-Output "install-postgres.log found at: $($installPostgresLog.FullName)" + Write-Output "Content of install-postgres.log:" + Get-Content -Path $installPostgresLog.FullName | ForEach-Object { Write-Output $_ } + } else { + Write-Output "install-postgres.log not found." + + # Recursively search for bitrock_installer.log or bitrock_installer_*.log + $bitrockInstallerLogs = @( + Get-ChildItem -Path $tempPath -Recurse -Filter "bitrock_installer.log" -ErrorAction SilentlyContinue, + Get-ChildItem -Path $tempPath -Recurse -Filter "bitrock_installer_*.log" -ErrorAction SilentlyContinue + ) + + # Flatten the array to remove nested arrays + $bitrockInstallerLogs = $bitrockInstallerLogs | Where-Object { $_ } + + foreach ($log in $bitrockInstallerLogs) { + if ($log) { + Write-Output "Found log file: $($log.FullName)" + Write-Output "Content of bitrock_install*.log:" + Get-Content -Path $log.FullName | ForEach-Object { Write-Output $_ } + break + } + } + + # If no log files were found + if (-not $log) { + Write-Warning "No relevant log files found in the temporary directory." + } + } +} # Get Path to pg_ctl.exe $pgPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName From 0d3756a2ec0bba0839dfc9bb25791cdc56c20387 Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Mon, 2 Dec 2024 14:36:15 +0000 Subject: [PATCH 09/20] Handle looking for installer log before exit --- .../scripts/build/Install-PostgreSQL.ps1 | 44 +++---------------- .../scripts/helpers/InstallHelpers.ps1 | 15 ++++++- 2 files changed, 19 insertions(+), 40 deletions(-) diff --git a/images/windows/scripts/build/Install-PostgreSQL.ps1 b/images/windows/scripts/build/Install-PostgreSQL.ps1 index 920600f36..94d3a1f07 100644 --- a/images/windows/scripts/build/Install-PostgreSQL.ps1 +++ b/images/windows/scripts/build/Install-PostgreSQL.ps1 @@ -70,46 +70,12 @@ if ((Get-ToolsetContent).postgresql.installVcRedist) { # 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") -try { - Install-Binary ` - -Url $installerUrl ` - -InstallArgs $installerArgs ` - -ExpectedSignature (Get-ToolsetContent).postgresql.signature -} catch { - # Recursively search for install-postgres.log - $installPostgresLog = Get-ChildItem -Path $env:TEMP -Recurse -Filter "install-postgresql.log" -ErrorAction SilentlyContinue | Select-Object -First 1 - if ($installPostgresLog) { - Write-Output "install-postgres.log found at: $($installPostgresLog.FullName)" - Write-Output "Content of install-postgres.log:" - Get-Content -Path $installPostgresLog.FullName | ForEach-Object { Write-Output $_ } - } else { - Write-Output "install-postgres.log not found." - - # Recursively search for bitrock_installer.log or bitrock_installer_*.log - $bitrockInstallerLogs = @( - Get-ChildItem -Path $tempPath -Recurse -Filter "bitrock_installer.log" -ErrorAction SilentlyContinue, - Get-ChildItem -Path $tempPath -Recurse -Filter "bitrock_installer_*.log" -ErrorAction SilentlyContinue - ) - - # Flatten the array to remove nested arrays - $bitrockInstallerLogs = $bitrockInstallerLogs | Where-Object { $_ } - - foreach ($log in $bitrockInstallerLogs) { - if ($log) { - Write-Output "Found log file: $($log.FullName)" - Write-Output "Content of bitrock_install*.log:" - Get-Content -Path $log.FullName | ForEach-Object { Write-Output $_ } - break - } - } - - # If no log files were found - if (-not $log) { - Write-Warning "No relevant log files found in the temporary directory." - } - } -} +Install-Binary ` + -Url $installerUrl ` + -InstallArgs $installerArgs ` + -ExpectedSignature (Get-ToolsetContent).postgresql.signature + -InstallerLogPath "$env:TEMP/**/postgresql-install.log" # Get Path to pg_ctl.exe $pgPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName diff --git a/images/windows/scripts/helpers/InstallHelpers.ps1 b/images/windows/scripts/helpers/InstallHelpers.ps1 index b491533e4..fa65a9dac 100644 --- a/images/windows/scripts/helpers/InstallHelpers.ps1 +++ b/images/windows/scripts/helpers/InstallHelpers.ps1 @@ -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" #> @@ -46,7 +50,8 @@ function Install-Binary { [String[]] $ExtraInstallArgs, [String[]] $ExpectedSignature, [String] $ExpectedSHA256Sum, - [String] $ExpectedSHA512Sum + [String] $ExpectedSHA512Sum, + [String] $InstallerLogPath ) if ($PSCmdlet.ParameterSetName -eq "LocalPath") { @@ -122,6 +127,14 @@ function Install-Binary { } else { Write-Host "Installation process returned unexpected exit code: $exitCode" Write-Host "Time elapsed: $installCompleteTime seconds" + + if ($InstallerLogPath -and (Test-Path -Path $InstallerLogPath)) { + Write-Host "Searching for logs maching $InstallerLogPath pattern" + Get-ChildItem -Path $InstallerLogPath | ForEach-Object { + Write-Output "Found Installer Log: $InstallerLogPath" + Get-Content -Path $InstallerLogPath + } + } exit $exitCode } } catch { From 4e756696cbf2cb95825a4178bab7700e1b36ae31 Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Mon, 2 Dec 2024 14:37:55 +0000 Subject: [PATCH 10/20] Hack: temp fix to improve debugging loop --- images/windows/templates/windows-2022.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/windows/templates/windows-2022.pkr.hcl b/images/windows/templates/windows-2022.pkr.hcl index 0c66a7dbf..d812d3a8e 100644 --- a/images/windows/templates/windows-2022.pkr.hcl +++ b/images/windows/templates/windows-2022.pkr.hcl @@ -341,6 +341,7 @@ build { provisioner "powershell" { environment_vars = ["IMAGE_FOLDER=${var.image_folder}", "TEMP_DIR=${var.temp_dir}"] scripts = [ + "${path.root}/../scripts/build/Install-PostgreSQL.ps1", "${path.root}/../scripts/build/Install-ActionsCache.ps1", "${path.root}/../scripts/build/Install-Ruby.ps1", "${path.root}/../scripts/build/Install-PyPy.ps1", @@ -380,7 +381,6 @@ build { "${path.root}/../scripts/build/Install-Zstd.ps1", "${path.root}/../scripts/build/Install-NSIS.ps1", "${path.root}/../scripts/build/Install-Vcpkg.ps1", - "${path.root}/../scripts/build/Install-PostgreSQL.ps1", "${path.root}/../scripts/build/Install-Bazel.ps1", "${path.root}/../scripts/build/Install-AliyunCli.ps1", "${path.root}/../scripts/build/Install-RootCA.ps1", From 692b6af2e9d10c0cfb64725f16a919bf574446af Mon Sep 17 00:00:00 2001 From: Lawrence Gripper Date: Tue, 3 Dec 2024 09:45:08 +0000 Subject: [PATCH 11/20] Update images/windows/scripts/helpers/InstallHelpers.ps1 --- images/windows/scripts/helpers/InstallHelpers.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/windows/scripts/helpers/InstallHelpers.ps1 b/images/windows/scripts/helpers/InstallHelpers.ps1 index fa65a9dac..da5c37fce 100644 --- a/images/windows/scripts/helpers/InstallHelpers.ps1 +++ b/images/windows/scripts/helpers/InstallHelpers.ps1 @@ -128,7 +128,7 @@ function Install-Binary { Write-Host "Installation process returned unexpected exit code: $exitCode" Write-Host "Time elapsed: $installCompleteTime seconds" - if ($InstallerLogPath -and (Test-Path -Path $InstallerLogPath)) { + if ($InstallerLogPath) { Write-Host "Searching for logs maching $InstallerLogPath pattern" Get-ChildItem -Path $InstallerLogPath | ForEach-Object { Write-Output "Found Installer Log: $InstallerLogPath" From 9d551e43bc19a75b6b01ff0a46291b98862903d8 Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Tue, 3 Dec 2024 13:48:31 +0000 Subject: [PATCH 12/20] =?UTF-8?q?Missing=20backtick=20=F0=9F=A4=A6?= =?UTF-8?q?=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- images/windows/scripts/build/Install-PostgreSQL.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/windows/scripts/build/Install-PostgreSQL.ps1 b/images/windows/scripts/build/Install-PostgreSQL.ps1 index 94d3a1f07..57c486a5e 100644 --- a/images/windows/scripts/build/Install-PostgreSQL.ps1 +++ b/images/windows/scripts/build/Install-PostgreSQL.ps1 @@ -74,7 +74,7 @@ $installerArgs = @("--install_runtimes 0", "--superpassword root", "--enable_acl Install-Binary ` -Url $installerUrl ` -InstallArgs $installerArgs ` - -ExpectedSignature (Get-ToolsetContent).postgresql.signature + -ExpectedSignature (Get-ToolsetContent).postgresql.signature ` -InstallerLogPath "$env:TEMP/**/postgresql-install.log" # Get Path to pg_ctl.exe From 1aad2d246dd32c066e683168237f7e757f147d6b Mon Sep 17 00:00:00 2001 From: Lawrence Gripper Date: Tue, 3 Dec 2024 20:33:13 +0000 Subject: [PATCH 13/20] Update images/windows/scripts/build/Install-PostgreSQL.ps1 --- images/windows/scripts/build/Install-PostgreSQL.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/windows/scripts/build/Install-PostgreSQL.ps1 b/images/windows/scripts/build/Install-PostgreSQL.ps1 index 57c486a5e..bb5369a65 100644 --- a/images/windows/scripts/build/Install-PostgreSQL.ps1 +++ b/images/windows/scripts/build/Install-PostgreSQL.ps1 @@ -75,7 +75,7 @@ Install-Binary ` -Url $installerUrl ` -InstallArgs $installerArgs ` -ExpectedSignature (Get-ToolsetContent).postgresql.signature ` - -InstallerLogPath "$env:TEMP/**/postgresql-install.log" + -InstallerLogPath "$env:TEMP\**\install-postgresql.log" # Get Path to pg_ctl.exe $pgPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName From 66ee99188480194054a36e36f8d89c178005a88d Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Wed, 4 Dec 2024 11:06:53 +0000 Subject: [PATCH 14/20] Missing recurse --- images/windows/scripts/helpers/InstallHelpers.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/windows/scripts/helpers/InstallHelpers.ps1 b/images/windows/scripts/helpers/InstallHelpers.ps1 index da5c37fce..2d0c45bf4 100644 --- a/images/windows/scripts/helpers/InstallHelpers.ps1 +++ b/images/windows/scripts/helpers/InstallHelpers.ps1 @@ -130,7 +130,7 @@ function Install-Binary { if ($InstallerLogPath) { Write-Host "Searching for logs maching $InstallerLogPath pattern" - Get-ChildItem -Path $InstallerLogPath | ForEach-Object { + Get-ChildItem -Recurse -Path $InstallerLogPath | ForEach-Object { Write-Output "Found Installer Log: $InstallerLogPath" Get-Content -Path $InstallerLogPath } From 18efc23fe3e39de13c9cc9d911430ce15810362a Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Wed, 4 Dec 2024 11:07:49 +0000 Subject: [PATCH 15/20] Quicker loop again --- images/windows/templates/windows-2022.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/windows/templates/windows-2022.pkr.hcl b/images/windows/templates/windows-2022.pkr.hcl index d812d3a8e..1aa2c8bd4 100644 --- a/images/windows/templates/windows-2022.pkr.hcl +++ b/images/windows/templates/windows-2022.pkr.hcl @@ -278,6 +278,7 @@ build { provisioner "powershell" { environment_vars = ["IMAGE_FOLDER=${var.image_folder}", "TEMP_DIR=${var.temp_dir}"] scripts = [ + "${path.root}/../scripts/build/Install-PostgreSQL.ps1", "${path.root}/../scripts/build/Install-Docker.ps1", "${path.root}/../scripts/build/Install-DockerWinCred.ps1", "${path.root}/../scripts/build/Install-DockerCompose.ps1", @@ -341,7 +342,6 @@ build { provisioner "powershell" { environment_vars = ["IMAGE_FOLDER=${var.image_folder}", "TEMP_DIR=${var.temp_dir}"] scripts = [ - "${path.root}/../scripts/build/Install-PostgreSQL.ps1", "${path.root}/../scripts/build/Install-ActionsCache.ps1", "${path.root}/../scripts/build/Install-Ruby.ps1", "${path.root}/../scripts/build/Install-PyPy.ps1", From 0fae0a3b0bef7ecf0d424efd575142e0b61e69f4 Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Wed, 4 Dec 2024 11:55:32 +0000 Subject: [PATCH 16/20] Fix getting output --- images/windows/scripts/helpers/InstallHelpers.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/images/windows/scripts/helpers/InstallHelpers.ps1 b/images/windows/scripts/helpers/InstallHelpers.ps1 index 2d0c45bf4..a3fefb7de 100644 --- a/images/windows/scripts/helpers/InstallHelpers.ps1 +++ b/images/windows/scripts/helpers/InstallHelpers.ps1 @@ -132,7 +132,8 @@ function Install-Binary { Write-Host "Searching for logs maching $InstallerLogPath pattern" Get-ChildItem -Recurse -Path $InstallerLogPath | ForEach-Object { Write-Output "Found Installer Log: $InstallerLogPath" - Get-Content -Path $InstallerLogPath + Write-Output "File content:" + Get-Content -Path $_.FullName } } exit $exitCode From 9f195304f155db27d81d8e1ff1268f79c46ca97e Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Wed, 4 Dec 2024 16:35:34 +0000 Subject: [PATCH 17/20] Put the installer back to original order --- images/windows/templates/windows-2022.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/windows/templates/windows-2022.pkr.hcl b/images/windows/templates/windows-2022.pkr.hcl index 1aa2c8bd4..0c66a7dbf 100644 --- a/images/windows/templates/windows-2022.pkr.hcl +++ b/images/windows/templates/windows-2022.pkr.hcl @@ -278,7 +278,6 @@ build { provisioner "powershell" { environment_vars = ["IMAGE_FOLDER=${var.image_folder}", "TEMP_DIR=${var.temp_dir}"] scripts = [ - "${path.root}/../scripts/build/Install-PostgreSQL.ps1", "${path.root}/../scripts/build/Install-Docker.ps1", "${path.root}/../scripts/build/Install-DockerWinCred.ps1", "${path.root}/../scripts/build/Install-DockerCompose.ps1", @@ -381,6 +380,7 @@ build { "${path.root}/../scripts/build/Install-Zstd.ps1", "${path.root}/../scripts/build/Install-NSIS.ps1", "${path.root}/../scripts/build/Install-Vcpkg.ps1", + "${path.root}/../scripts/build/Install-PostgreSQL.ps1", "${path.root}/../scripts/build/Install-Bazel.ps1", "${path.root}/../scripts/build/Install-AliyunCli.ps1", "${path.root}/../scripts/build/Install-RootCA.ps1", From 1d54963a0a5d4eb234db90f70f3067693b639786 Mon Sep 17 00:00:00 2001 From: Lawrence Gripper Date: Thu, 9 Jan 2025 11:41:29 +0000 Subject: [PATCH 18/20] Temp DO NOT MERGE: remove azcopy to test postgres --- images/windows/toolsets/toolset-2019.json | 1 - 1 file changed, 1 deletion(-) diff --git a/images/windows/toolsets/toolset-2019.json b/images/windows/toolsets/toolset-2019.json index 2f45a1678..2e83ff387 100644 --- a/images/windows/toolsets/toolset-2019.json +++ b/images/windows/toolsets/toolset-2019.json @@ -423,7 +423,6 @@ "common_packages": [ { "name": "7zip.install" }, { "name": "aria2" }, - { "name": "azcopy10" }, { "name": "Bicep" }, { "name": "gitversion.portable"}, { "name": "innosetup" }, From 619f42518497dcd59d1bb7992b75cacc774f8800 Mon Sep 17 00:00:00 2001 From: Lawrence Gripper Date: Mon, 13 Jan 2025 12:52:03 +0000 Subject: [PATCH 19/20] Update toolset-2019.json --- images/windows/toolsets/toolset-2019.json | 1 + 1 file changed, 1 insertion(+) diff --git a/images/windows/toolsets/toolset-2019.json b/images/windows/toolsets/toolset-2019.json index 2e83ff387..07e3265ee 100644 --- a/images/windows/toolsets/toolset-2019.json +++ b/images/windows/toolsets/toolset-2019.json @@ -424,6 +424,7 @@ { "name": "7zip.install" }, { "name": "aria2" }, { "name": "Bicep" }, + { "name": "azcopy10" }, { "name": "gitversion.portable"}, { "name": "innosetup" }, { "name": "jq" }, From 043bfb130ff29e29d601c1c041779cb515b022bd Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Tue, 14 Jan 2025 12:29:48 +0000 Subject: [PATCH 20/20] Put in right place --- images/windows/toolsets/toolset-2019.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/windows/toolsets/toolset-2019.json b/images/windows/toolsets/toolset-2019.json index bb79c9edb..c58751bc7 100644 --- a/images/windows/toolsets/toolset-2019.json +++ b/images/windows/toolsets/toolset-2019.json @@ -419,9 +419,9 @@ "choco": { "common_packages": [ { "name": "7zip.install" }, + { "name": "azcopy10" }, { "name": "aria2" }, { "name": "Bicep" }, - { "name": "azcopy10" }, { "name": "gitversion.portable"}, { "name": "innosetup" }, { "name": "jq" },