2019-07-31 22:56:46 +05:30
|
|
|
function retry() {
|
2017-08-17 22:00:37 +05:30
|
|
|
if eval "$@"; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i in 2 1; do
|
|
|
|
sleep 3s
|
|
|
|
echo "Retrying $i..."
|
|
|
|
if eval "$@"; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
return 1
|
|
|
|
}
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
function setup_db_user_only() {
|
2020-01-01 13:55:28 +05:30
|
|
|
source scripts/create_postgres_user.sh
|
2018-11-08 19:23:39 +05:30
|
|
|
}
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
function setup_db() {
|
2018-11-08 19:23:39 +05:30
|
|
|
setup_db_user_only
|
|
|
|
|
|
|
|
bundle exec rake db:drop db:create db:schema:load db:migrate
|
|
|
|
|
2019-10-12 21:52:04 +05:30
|
|
|
bundle exec rake gitlab:db:setup_ee
|
2018-11-08 19:23:39 +05:30
|
|
|
}
|
2019-07-31 22:56:46 +05:30
|
|
|
|
|
|
|
function install_api_client_dependencies_with_apk() {
|
|
|
|
apk add --update openssl curl jq
|
|
|
|
}
|
|
|
|
|
|
|
|
function install_api_client_dependencies_with_apt() {
|
|
|
|
apt update && apt install jq -y
|
|
|
|
}
|
|
|
|
|
|
|
|
function install_gitlab_gem() {
|
2020-01-01 13:55:28 +05:30
|
|
|
gem install httparty --no-document --version 0.17.3
|
|
|
|
gem install gitlab --no-document --version 4.13.0
|
2019-07-31 22:56:46 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
function echoerr() {
|
|
|
|
local header="${2}"
|
|
|
|
|
|
|
|
if [ -n "${header}" ]; then
|
|
|
|
printf "\n\033[0;31m** %s **\n\033[0m" "${1}" >&2;
|
|
|
|
else
|
|
|
|
printf "\033[0;31m%s\n\033[0m" "${1}" >&2;
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function echoinfo() {
|
|
|
|
local header="${2}"
|
|
|
|
|
|
|
|
if [ -n "${header}" ]; then
|
|
|
|
printf "\n\033[0;33m** %s **\n\033[0m" "${1}" >&2;
|
|
|
|
else
|
|
|
|
printf "\033[0;33m%s\n\033[0m" "${1}" >&2;
|
|
|
|
fi
|
|
|
|
}
|