[windows] Pin PostgreSQL and Update LLVM (#10014)

* [windows] Pin PostgreSQL version

* Fix if statement

* Fix PostgreSQL pester test

* Update LLVM to 18*
This commit is contained in:
Shamil Mubarakshin
2024-06-08 11:02:11 +02:00
committed by GitHub
parent 7271f004d4
commit 870d08d9cb
4 changed files with 49 additions and 41 deletions

View File

@@ -11,44 +11,52 @@ $pgPwd = "root"
[Environment]::SetEnvironmentVariable("PGUSER", $pgUser, "Machine")
[Environment]::SetEnvironmentVariable("PGPASSWORD", $pgPwd, "Machine")
# Define latest available version to install based on version specified in the toolset
$toolsetVersion = (Get-ToolsetContent).postgresql.version
$getPostgreReleases = Invoke-WebRequest -Uri "https://git.postgresql.org/gitweb/?p=postgresql.git;a=tags" -UseBasicParsing
# Getting all links matched to the pattern (e.g.a=log;h=refs/tags/REL_14)
$targetReleases = $getPostgreReleases.Links.href | Where-Object { $_ -match "a=log;h=refs/tags/REL_$toolsetVersion" }
[Int32] $outNumber = $null
$minorVersions = @()
foreach ($release in $targetReleases) {
$version = $release.split('/')[-1]
# Checking if the latest symbol of the release version is actually a number. If yes, add to $minorVersions array
if ([Int32]::TryParse($($version.Split('_')[-1]), [ref] $outNumber)) {
$minorVersions += $outNumber
if ($null -ne ($toolsetVersion | Select-String -Pattern '\d+\.\d+\.\d+')) {
$majorVersion = ([version]$toolsetVersion).Major
$minorVersion = ([version]$toolsetVersion).Minor
$patchVersion = ([version]$toolsetVersion).Build
$installerUrl = "https://get.enterprisedb.com/postgresql/postgresql-$majorVersion.$minorVersion-$patchVersion-windows-x64.exe"
} else {
# Define latest available version to install based on version specified in the toolset
$getPostgreReleases = Invoke-WebRequest -Uri "https://git.postgresql.org/gitweb/?p=postgresql.git;a=tags" -UseBasicParsing
# Getting all links matched to the pattern (e.g.a=log;h=refs/tags/REL_14)
$targetReleases = $getPostgreReleases.Links.href | Where-Object { $_ -match "a=log;h=refs/tags/REL_$toolsetVersion" }
[Int32] $outNumber = $null
$minorVersions = @()
foreach ($release in $targetReleases) {
$version = $release.split('/')[-1]
# Checking if the latest symbol of the release version is actually a number. If yes, add to $minorVersions array
if ([Int32]::TryParse($($version.Split('_')[-1]), [ref] $outNumber)) {
$minorVersions += $outNumber
}
}
}
# Sorting and getting the last one
$targetMinorVersions = ($minorVersions | Sort-Object)[-1]
# Sorting and getting the last one
$targetMinorVersions = ($minorVersions | Sort-Object)[-1]
# Install latest PostgreSQL
# In order to get rid of error messages (we know we will have them), force ErrorAction to SilentlyContinue
$errorActionOldValue = $ErrorActionPreference
$ErrorActionPreference = 'SilentlyContinue'
# Starting from number 9 and going down, check if the installer is available. If yes, break the loop.
# If an installer with $targetMinorVersions is not to be found, the $targetMinorVersions will be decreased by 1
$increment = 9
do {
$url = "https://get.enterprisedb.com/postgresql/postgresql-$toolsetVersion.$targetMinorVersions-$increment-windows-x64.exe"
$checkAccess = [System.Net.WebRequest]::Create($url)
$response = $null
$response = $checkAccess.GetResponse()
if ($response) {
$installerUrl = $response.ResponseUri.OriginalString
} elseif (!$response -and ($increment -eq 0)) {
$increment = 9
$targetMinorVersions--
} else {
$increment--
}
} while (!$response)
# In order to get rid of error messages (we know we will have them), force ErrorAction to SilentlyContinue
$errorActionOldValue = $ErrorActionPreference
$ErrorActionPreference = 'SilentlyContinue'
# Install latest PostgreSQL
# Starting from number 9 and going down, check if the installer is available. If yes, break the loop.
# If an installer with $targetMinorVersions is not to be found, the $targetMinorVersions will be decreased by 1
$increment = 9
do {
$url = "https://get.enterprisedb.com/postgresql/postgresql-$toolsetVersion.$targetMinorVersions-$increment-windows-x64.exe"
$checkAccess = [System.Net.WebRequest]::Create($url)
$response = $null
$response = $checkAccess.GetResponse()
if ($response) {
$installerUrl = $response.ResponseUri.OriginalString
} elseif (!$response -and ($increment -eq 0)) {
$increment = 9
$targetMinorVersions--
} else {
$increment--
}
} while (!$response)
}
# Return the previous value of ErrorAction and invoke Install-Binary function
$ErrorActionPreference = $errorActionOldValue

View File

@@ -72,8 +72,8 @@ Describe "PostgreSQL" {
}
Context "PostgreSQL version" {
It "PostgreSQL version should correspond to the version in the toolset" {
$toolsetVersion = (Get-ToolsetContent).postgresql.version
It "PostgreSQL version should correspond to the Major version in the toolset" {
$toolsetVersion = (Get-ToolsetContent).postgresql.version.Split(".")[0]
# Client version
(& $env:PGBIN\psql --version).split()[-1] | Should -BeLike "$toolsetVersion*"
# Server version

View File

@@ -469,10 +469,10 @@
"version": "8.3"
},
"llvm": {
"version": "16"
"version": "18"
},
"postgresql": {
"version": "14",
"version": "14.12.1",
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9"
},
"kotlin": {

View File

@@ -367,13 +367,13 @@
"version": "3.10"
},
"llvm": {
"version": "16"
"version": "18"
},
"php": {
"version": "8.3"
},
"postgresql": {
"version": "14",
"version": "14.12.1",
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9"
},
"kotlin": {