summaryrefslogtreecommitdiff
path: root/scripts/utils.sh
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /scripts/utils.sh
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
downloadgitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'scripts/utils.sh')
-rw-r--r--scripts/utils.sh35
1 files changed, 30 insertions, 5 deletions
diff --git a/scripts/utils.sh b/scripts/utils.sh
index d1f98bb3f62..897f8d5a8b8 100644
--- a/scripts/utils.sh
+++ b/scripts/utils.sh
@@ -18,11 +18,8 @@ function setup_db_user_only() {
}
function setup_db() {
- setup_db_user_only
-
- bundle exec rake db:drop db:create db:structure:load db:migrate
-
- bundle exec rake gitlab:db:setup_ee
+ run_timed_command "setup_db_user_only"
+ run_timed_command "bundle exec rake db:drop db:create db:structure:load db:migrate gitlab:db:setup_ee"
}
function install_api_client_dependencies_with_apk() {
@@ -38,6 +35,24 @@ function install_gitlab_gem() {
gem install gitlab --no-document --version 4.13.0
}
+function run_timed_command() {
+ local cmd="${1}"
+ local start=$(date +%s)
+ echosuccess "\$ ${cmd}"
+ eval "${cmd}"
+ local ret=$?
+ local end=$(date +%s)
+ local runtime=$((end-start))
+
+ if [[ $ret -eq 0 ]]; then
+ echosuccess "==> '${cmd}' succeeded in ${runtime} seconds."
+ return 0
+ else
+ echoerr "==> '${cmd}' failed (${ret}) in ${runtime} seconds."
+ return $ret
+ fi
+}
+
function echoerr() {
local header="${2}"
@@ -58,6 +73,16 @@ function echoinfo() {
fi
}
+function echosuccess() {
+ local header="${2}"
+
+ if [ -n "${header}" ]; then
+ printf "\n\033[0;32m** %s **\n\033[0m" "${1}" >&2;
+ else
+ printf "\033[0;32m%s\n\033[0m" "${1}" >&2;
+ fi
+}
+
function get_job_id() {
local job_name="${1}"
local query_string="${2:+&${2}}"