Files
runner-images/images/macos/scripts/build/install-postgresql.sh
Alexey-Ayupov 5a6e215859 [macOS] Refactor the rest of the scripts (#9113)
* [macOS] Refactor the rest of the scripts

* Return quotes to config tccdb script

* Return quotes to config tccdb script

* Revert some changes in ruby scripts

* Revert some changes in ruby scripts

* Revert some changes chrome script

* check errors

* check errors 01

* find errors in common-utils

* find errors in edge install

* find errors in edge install

---------

Co-authored-by: Alexey Ayupov <“alexey.ayupov@akvelon.com”>
2024-01-09 14:47:31 +01:00

39 lines
1.1 KiB
Bash

#!/bin/bash -e -o pipefail
################################################################################
## File: install-postgresql.sh
## Desc: Install PostgreSQL
################################################################################
source ~/utils/utils.sh
# Fetch PostgreSQL version to install from the toolset
toolsetVersion=$(get_toolset_value '.postgresql.version')
# Install latest version of PostgreSQL
brew_smart_install postgresql@$toolsetVersion
# Service PostgreSQL should be started before use
postgreService=$(brew services list | grep -oe "postgresql\S*")
brew services start $postgreService
# Verify PostgreSQL is ready for accept incoming connections
echo "Check PostgreSQL service is running"
i=10
COMMAND='pg_isready'
while [[ $i -gt 0 ]]; do
echo "Check PostgreSQL service status"
eval $COMMAND && break
((i--))
if [[ $i == 0 ]]; then
echo "PostgreSQL service not ready, all attempts exhausted"
exit 1
fi
echo "PostgreSQL service not ready, wait 10 more sec, attempts left: $i"
sleep 10
done
# Stop PostgreSQL
brew services stop $postgreService
invoke_tests "Databases" "PostgreSQL"