diff --git a/.gitlab/cdrouter.yml b/.gitlab/cdrouter.yml index dbe52c633c..6cf82eff76 100644 --- a/.gitlab/cdrouter.yml +++ b/.gitlab/cdrouter.yml @@ -146,12 +146,12 @@ - > if test -n "$cdrouter_exit_code"; then - echo "CDRouter exited with $cdrouter_exit_code exit code." + log_error "CDRouter exited with $cdrouter_exit_code exit code." exit "$cdrouter_exit_code" fi if test -n "$cram_exit_code"; then - echo "cram exited with $cram_exit_code exit code." + log_error "cram exited with $cram_exit_code exit code." exit "$cram_exit_code" fi diff --git a/.gitlab/scripts/dut-init/cdrouter-dut-configure-wireless.sh b/.gitlab/scripts/dut-init/cdrouter-dut-configure-wireless.sh index 0e2e1d6d84..cad75ad914 100755 --- a/.gitlab/scripts/dut-init/cdrouter-dut-configure-wireless.sh +++ b/.gitlab/scripts/dut-init/cdrouter-dut-configure-wireless.sh @@ -1,15 +1,13 @@ #!/bin/bash +source .gitlab/scripts/helpers.sh + set -eu # exit on error and undefined variables set -o pipefail # catch errors in pipes radio_2g_path="" ssid_2g_path="" -log_error() { echo -e "\e[91m❌ ERROR: $*\e[0m"; } -log_success() { echo -e "\e[92m✅ $*\e[0m"; } -log_info() { echo -e "\e[93m💡 $*\e[0m"; } - trap 'handle_error $? $LINENO $BASH_LINENO "$BASH_COMMAND" $(printf "::%s" ${FUNCNAME[@]:-})' ERR handle_error() { diff --git a/.gitlab/scripts/helpers.sh b/.gitlab/scripts/helpers.sh index f53833f2c8..32337a75ae 100644 --- a/.gitlab/scripts/helpers.sh +++ b/.gitlab/scripts/helpers.sh @@ -1,5 +1,9 @@ #!/bin/bash +log_error() { echo -e "\e[91m❌ ERROR: $*\e[0m"; } +log_success() { echo -e "\e[92m✅ $*\e[0m"; } +log_info() { echo -e "\e[93m💡 $*\e[0m"; } + # section_start - Start a collapsible section in GitLab CI job logs # # Creates a collapsible section marker in GitLab CI logs that can be expanded diff --git a/.gitlab/testbed.yml b/.gitlab/testbed.yml index f7a0d02368..b2396df612 100644 --- a/.gitlab/testbed.yml +++ b/.gitlab/testbed.yml @@ -107,7 +107,7 @@ local statuses=("${PIPESTATUS[@]}") for status in "${statuses[@]}"; do if [ "$status" -ne 0 ]; then - echo "run_check: $* | FAILED! (status: $status)" >> .run_check_failed + log_error "run_check: $* | FAILED! (status: $status)" | tee -a .run_check_failed fi done }