mirror of
https://github.com/actions/runner-images.git
synced 2025-12-16 06:40:32 +00:00
[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:
committed by
GitHub
parent
7271f004d4
commit
870d08d9cb
@@ -11,44 +11,52 @@ $pgPwd = "root"
|
|||||||
[Environment]::SetEnvironmentVariable("PGUSER", $pgUser, "Machine")
|
[Environment]::SetEnvironmentVariable("PGUSER", $pgUser, "Machine")
|
||||||
[Environment]::SetEnvironmentVariable("PGPASSWORD", $pgPwd, "Machine")
|
[Environment]::SetEnvironmentVariable("PGPASSWORD", $pgPwd, "Machine")
|
||||||
|
|
||||||
# Define latest available version to install based on version specified in the toolset
|
|
||||||
$toolsetVersion = (Get-ToolsetContent).postgresql.version
|
$toolsetVersion = (Get-ToolsetContent).postgresql.version
|
||||||
$getPostgreReleases = Invoke-WebRequest -Uri "https://git.postgresql.org/gitweb/?p=postgresql.git;a=tags" -UseBasicParsing
|
if ($null -ne ($toolsetVersion | Select-String -Pattern '\d+\.\d+\.\d+')) {
|
||||||
# Getting all links matched to the pattern (e.g.a=log;h=refs/tags/REL_14)
|
$majorVersion = ([version]$toolsetVersion).Major
|
||||||
$targetReleases = $getPostgreReleases.Links.href | Where-Object { $_ -match "a=log;h=refs/tags/REL_$toolsetVersion" }
|
$minorVersion = ([version]$toolsetVersion).Minor
|
||||||
[Int32] $outNumber = $null
|
$patchVersion = ([version]$toolsetVersion).Build
|
||||||
$minorVersions = @()
|
$installerUrl = "https://get.enterprisedb.com/postgresql/postgresql-$majorVersion.$minorVersion-$patchVersion-windows-x64.exe"
|
||||||
foreach ($release in $targetReleases) {
|
} else {
|
||||||
$version = $release.split('/')[-1]
|
# Define latest available version to install based on version specified in the toolset
|
||||||
# Checking if the latest symbol of the release version is actually a number. If yes, add to $minorVersions array
|
$getPostgreReleases = Invoke-WebRequest -Uri "https://git.postgresql.org/gitweb/?p=postgresql.git;a=tags" -UseBasicParsing
|
||||||
if ([Int32]::TryParse($($version.Split('_')[-1]), [ref] $outNumber)) {
|
# Getting all links matched to the pattern (e.g.a=log;h=refs/tags/REL_14)
|
||||||
$minorVersions += $outNumber
|
$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
|
||||||
# Sorting and getting the last one
|
$targetMinorVersions = ($minorVersions | Sort-Object)[-1]
|
||||||
$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
|
||||||
# In order to get rid of error messages (we know we will have them), force ErrorAction to SilentlyContinue
|
$errorActionOldValue = $ErrorActionPreference
|
||||||
$errorActionOldValue = $ErrorActionPreference
|
$ErrorActionPreference = 'SilentlyContinue'
|
||||||
$ErrorActionPreference = 'SilentlyContinue'
|
|
||||||
# Starting from number 9 and going down, check if the installer is available. If yes, break the loop.
|
# Install latest PostgreSQL
|
||||||
# If an installer with $targetMinorVersions is not to be found, the $targetMinorVersions will be decreased by 1
|
# Starting from number 9 and going down, check if the installer is available. If yes, break the loop.
|
||||||
$increment = 9
|
# If an installer with $targetMinorVersions is not to be found, the $targetMinorVersions will be decreased by 1
|
||||||
do {
|
$increment = 9
|
||||||
$url = "https://get.enterprisedb.com/postgresql/postgresql-$toolsetVersion.$targetMinorVersions-$increment-windows-x64.exe"
|
do {
|
||||||
$checkAccess = [System.Net.WebRequest]::Create($url)
|
$url = "https://get.enterprisedb.com/postgresql/postgresql-$toolsetVersion.$targetMinorVersions-$increment-windows-x64.exe"
|
||||||
$response = $null
|
$checkAccess = [System.Net.WebRequest]::Create($url)
|
||||||
$response = $checkAccess.GetResponse()
|
$response = $null
|
||||||
if ($response) {
|
$response = $checkAccess.GetResponse()
|
||||||
$installerUrl = $response.ResponseUri.OriginalString
|
if ($response) {
|
||||||
} elseif (!$response -and ($increment -eq 0)) {
|
$installerUrl = $response.ResponseUri.OriginalString
|
||||||
$increment = 9
|
} elseif (!$response -and ($increment -eq 0)) {
|
||||||
$targetMinorVersions--
|
$increment = 9
|
||||||
} else {
|
$targetMinorVersions--
|
||||||
$increment--
|
} else {
|
||||||
}
|
$increment--
|
||||||
} while (!$response)
|
}
|
||||||
|
} while (!$response)
|
||||||
|
}
|
||||||
|
|
||||||
# Return the previous value of ErrorAction and invoke Install-Binary function
|
# Return the previous value of ErrorAction and invoke Install-Binary function
|
||||||
$ErrorActionPreference = $errorActionOldValue
|
$ErrorActionPreference = $errorActionOldValue
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ Describe "PostgreSQL" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Context "PostgreSQL version" {
|
Context "PostgreSQL version" {
|
||||||
It "PostgreSQL version should correspond to the version in the toolset" {
|
It "PostgreSQL version should correspond to the Major version in the toolset" {
|
||||||
$toolsetVersion = (Get-ToolsetContent).postgresql.version
|
$toolsetVersion = (Get-ToolsetContent).postgresql.version.Split(".")[0]
|
||||||
# Client version
|
# Client version
|
||||||
(& $env:PGBIN\psql --version).split()[-1] | Should -BeLike "$toolsetVersion*"
|
(& $env:PGBIN\psql --version).split()[-1] | Should -BeLike "$toolsetVersion*"
|
||||||
# Server version
|
# Server version
|
||||||
|
|||||||
@@ -469,10 +469,10 @@
|
|||||||
"version": "8.3"
|
"version": "8.3"
|
||||||
},
|
},
|
||||||
"llvm": {
|
"llvm": {
|
||||||
"version": "16"
|
"version": "18"
|
||||||
},
|
},
|
||||||
"postgresql": {
|
"postgresql": {
|
||||||
"version": "14",
|
"version": "14.12.1",
|
||||||
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9"
|
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9"
|
||||||
},
|
},
|
||||||
"kotlin": {
|
"kotlin": {
|
||||||
|
|||||||
@@ -367,13 +367,13 @@
|
|||||||
"version": "3.10"
|
"version": "3.10"
|
||||||
},
|
},
|
||||||
"llvm": {
|
"llvm": {
|
||||||
"version": "16"
|
"version": "18"
|
||||||
},
|
},
|
||||||
"php": {
|
"php": {
|
||||||
"version": "8.3"
|
"version": "8.3"
|
||||||
},
|
},
|
||||||
"postgresql": {
|
"postgresql": {
|
||||||
"version": "14",
|
"version": "14.12.1",
|
||||||
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9"
|
"signature": "698BA51AA27CC31282AACA5055E4B9190BC6C0E9"
|
||||||
},
|
},
|
||||||
"kotlin": {
|
"kotlin": {
|
||||||
|
|||||||
Reference in New Issue
Block a user