From 7bc205498b711914210d48039556bb6307cdcbbc Mon Sep 17 00:00:00 2001 From: Varac <varac@varac.net> Date: Wed, 11 Aug 2021 14:53:30 +0200 Subject: [PATCH] Add configurable sleep interval for retry_cmd_until_success.sh --- .gitlab-ci.yml | 6 +++--- .gitlab/ci_scripts/retry_cmd_until_success.sh | 21 ++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 92d458e7f..99420c7fe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -867,8 +867,9 @@ kube-prometheus-stack-alerts: before_script: - *debug_information script: - # Retry taiko tests multiple times until they succeed - - bash ./.gitlab/ci_scripts/retry_cmd_until_success.sh 20 unbuffer python3 -m openappstack $HOSTNAME test --apps $RESOURCE | ts -i | ts + # Retry taiko tests 60 times until they succeed, + # with a sleep interval of 10s in between tests + - bash ./.gitlab/ci_scripts/retry_cmd_until_success.sh 60 10 unbuffer python3 -m openappstack $HOSTNAME test --apps $RESOURCE | ts -i | ts artifacts: paths: - test/taiko/Screenshot* @@ -905,7 +906,6 @@ rocketchat-taiko: extends: - .taiko - .rocketchat_rules - allow_failure: true wekan-taiko: variables: diff --git a/.gitlab/ci_scripts/retry_cmd_until_success.sh b/.gitlab/ci_scripts/retry_cmd_until_success.sh index 33c8aa78d..e165988af 100755 --- a/.gitlab/ci_scripts/retry_cmd_until_success.sh +++ b/.gitlab/ci_scripts/retry_cmd_until_success.sh @@ -4,22 +4,29 @@ # # Usage: # -# ./retry_cmd_until_success.sh [retries] [cmd] +# ./retry_cmd_until_success.sh [retries] [sleep] [cmd] # # Example: # -# ./retry_cmd_until_success.sh 10 ping ix.de +# ./retry_cmd_until_success.sh 10 20 ping ix.de retries=$1 -shift -cmd=$* - if [[ ! $retries =~ ^-?[0-9]+$ ]] then echo "Please specify retries count." exit 1 fi +shift +sleep_secs=$1 +if [[ ! $sleep_secs =~ ^-?[0-9]+$ ]] +then + echo "Please specify sleep interval in seconds." + exit 1 +fi + +shift +cmd=$* if [[ -z "$cmd" ]] then echo "Please specify a cmd." @@ -31,11 +38,11 @@ i=0 until eval $cmd do echo -e "return code: $?\n" - if [[ $i -ge 2 ]] + if [[ $i -ge $retries ]] then exit 1 fi (( i++ )) - sleep 1 + sleep $sleep_secs echo "${i}. retry:" done -- GitLab