mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-17 23:36:44 +00:00
[Ubuntu] Pin PostgreSQL version installed in the toolset (#4510)
* Pin PostgreSQL version installed in the toolset * Source the helpers and resolving comments
This commit is contained in:
@@ -1,18 +1,26 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
################################################################################
|
################################################################################
|
||||||
## File: postgresql.sh
|
## File: postgresql.sh
|
||||||
## Desc: Installs Postgresql
|
## Desc: Installs PostgreSQL
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
# Source the helpers
|
||||||
|
source $HELPER_SCRIPTS/os.sh
|
||||||
|
source $HELPER_SCRIPTS/install.sh
|
||||||
|
|
||||||
REPO_URL="https://apt.postgresql.org/pub/repos/apt/"
|
REPO_URL="https://apt.postgresql.org/pub/repos/apt/"
|
||||||
|
|
||||||
#Preparing repo for PostgreSQL 12.
|
# Preparing repo for PostgreSQL
|
||||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
||||||
echo "deb $REPO_URL `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
|
echo "deb $REPO_URL $(getOSVersionLabel)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
|
||||||
|
|
||||||
|
# Fetch PostgreSQL version to install from the toolset
|
||||||
|
toolsetVersion=$(get_toolset_value '.postgresql.version')
|
||||||
|
|
||||||
|
# Install PostgreSQL
|
||||||
echo "Install PostgreSQL"
|
echo "Install PostgreSQL"
|
||||||
apt update
|
apt update
|
||||||
apt install postgresql postgresql-client
|
apt install postgresql-$toolsetVersion
|
||||||
|
|
||||||
echo "Install libpq-dev"
|
echo "Install libpq-dev"
|
||||||
apt-get install libpq-dev
|
apt-get install libpq-dev
|
||||||
|
|||||||
@@ -9,12 +9,19 @@ Describe "MongoDB" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Describe "PostgreSQL" {
|
Describe "PostgreSQL" {
|
||||||
|
|
||||||
It "PostgreSQL Service" {
|
It "PostgreSQL Service" {
|
||||||
"sudo systemctl start postgresql" | Should -ReturnZeroExitCode
|
"sudo systemctl start postgresql" | Should -ReturnZeroExitCode
|
||||||
(Get-CommandResult "pg_isready").Output | Should -Be "/var/run/postgresql:5432 - accepting connections"
|
(Get-CommandResult "pg_isready").Output | Should -Be "/var/run/postgresql:5432 - accepting connections"
|
||||||
"sudo systemctl stop postgresql" | Should -ReturnZeroExitCode
|
"sudo systemctl stop postgresql" | Should -ReturnZeroExitCode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
It "PostgreSQL version should correspond to the version in the toolset" {
|
||||||
|
$toolsetVersion = (Get-ToolsetContent).postgresql.version
|
||||||
|
# Client version
|
||||||
|
(psql --version).split()[-1] | Should -BeLike "$toolsetVersion*"
|
||||||
|
# Server version
|
||||||
|
(pg_config --version).split()[-1] | Should -BeLike "$toolsetVersion*"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Describe "MySQL" {
|
Describe "MySQL" {
|
||||||
|
|||||||
@@ -330,5 +330,8 @@
|
|||||||
],
|
],
|
||||||
"mongodb": {
|
"mongodb": {
|
||||||
"version": "5.0"
|
"version": "5.0"
|
||||||
|
},
|
||||||
|
"postgresql": {
|
||||||
|
"version": "14"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -335,5 +335,8 @@
|
|||||||
],
|
],
|
||||||
"mongodb": {
|
"mongodb": {
|
||||||
"version": "5.0"
|
"version": "5.0"
|
||||||
|
},
|
||||||
|
"postgresql": {
|
||||||
|
"version": "14"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user