ci: testbed,cdrouter: improve error visibility with colored logging
Currently it's not easy to identify errors in CI job log output, so let's introduce centralized logging helpers with colored output and visual indicators to make errors more prominent. The helpers are consolidated in .gitlab/scripts/helpers.sh and replace inline logging in dut-init scripts. Error messages in cdrouter.yml and testbed.yml now use log_error() for hopefully better visibility in CI logs. References: PCF-2157 Signed-off-by: Petr Štetiar <petr.stetiar@prplfoundation.org>
This commit is contained in:
parent
dd6d350a65
commit
a4ff6b0ccf
@ -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
|
||||
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user