summaryrefslogtreecommitdiff
path: root/scripts/utils.sh
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-24 21:15:17 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-24 21:15:17 +0000
commit0afa6fb9d922cb7e201e81b2b668258d3dcf9d46 (patch)
tree6cc932813286d30095068905cf30b45cbf609558 /scripts/utils.sh
parent94ca43181461c52ca0381d414387b02e579dbc61 (diff)
downloadgitlab-ce-0afa6fb9d922cb7e201e81b2b668258d3dcf9d46.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts/utils.sh')
-rw-r--r--scripts/utils.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/utils.sh b/scripts/utils.sh
index c20508617b8..e896fe40e06 100644
--- a/scripts/utils.sh
+++ b/scripts/utils.sh
@@ -83,7 +83,7 @@ function install_junit_merge_gem() {
function run_timed_command() {
local cmd="${1}"
- local metric_name="${2}"
+ local metric_name="${2:-no}"
local timed_metric_file
local start=$(date +%s)
@@ -97,7 +97,7 @@ function run_timed_command() {
if [[ $ret -eq 0 ]]; then
echosuccess "==> '${cmd}' succeeded in ${runtime} seconds."
- if [[ -n "${metric_name}" ]]; then
+ if [[ "${metric_name}" != "no" ]]; then
timed_metric_file=$(timed_metric_file $metric_name)
echo "# TYPE ${metric_name} gauge" > "${timed_metric_file}"
echo "# UNIT ${metric_name} seconds" >> "${timed_metric_file}"
@@ -132,9 +132,9 @@ function timed_metric_file() {
}
function echoerr() {
- local header="${2}"
+ local header="${2:-no}"
- if [ -n "${header}" ]; then
+ if [ "${header}" != "no" ]; then
printf "\n\033[0;31m** %s **\n\033[0m" "${1}" >&2;
else
printf "\033[0;31m%s\n\033[0m" "${1}" >&2;
@@ -142,9 +142,9 @@ function echoerr() {
}
function echoinfo() {
- local header="${2}"
+ local header="${2:-no}"
- if [ -n "${header}" ]; then
+ if [ "${header}" != "no" ]; then
printf "\n\033[0;33m** %s **\n\033[0m" "${1}" >&2;
else
printf "\033[0;33m%s\n\033[0m" "${1}" >&2;
@@ -152,9 +152,9 @@ function echoinfo() {
}
function echosuccess() {
- local header="${2}"
+ local header="${2:-no}"
- if [ -n "${header}" ]; then
+ if [ "${header}" != "no" ]; then
printf "\n\033[0;32m** %s **\n\033[0m" "${1}" >&2;
else
printf "\033[0;32m%s\n\033[0m" "${1}" >&2;