logging: curb CI/GHA special errors for cascading errors during build failure

- otherwise we get 4 errors for each "error" in CI
  - one for the real error
  - one for "wait for cleanups"
  - one for "Docker build failed"
  - one from GHA itself since command failed (we can't get rid of this)
This commit is contained in:
Ricardo Pardini
2023-05-08 14:10:21 +02:00
committed by igorpecovnik
parent 25929ea6ac
commit f0f9159faa
3 changed files with 5 additions and 3 deletions

View File

@@ -578,7 +578,8 @@ function docker_cli_launch() {
display_alert "-------------Docker run finished after ${SECONDS}s------------------------" "🐳 successfull" "info"
else
docker_build_result=$? # capture exit code of test done 4 lines above.
display_alert "-------------Docker run failed after ${SECONDS}s--------------------------" "🐳 failed" "err"
# No use polluting GHA/CI with notices about Docker failure (real failure, inside Docker, generated enough errors already) skip_ci_special="yes"
skip_ci_special="yes" display_alert "-------------Docker run failed after ${SECONDS}s--------------------------" "🐳 failed" "err"
fi
# Find and show the path to the log file for the ARMBIAN_BUILD_UUID.

View File

@@ -198,7 +198,7 @@ function display_alert() {
echo -e "${normal_color}${left_marker:-}${padding:-}${level_indicator}${padding}${normal_color}${right_marker:-}${timing_info}${pids_info}${bashopts_info} ${normal_color}${message}${extra}${normal_color}" >&2
# Now write to CI, if we're running on it. Remove ANSI escapes which confuse GitHub Actions.
if [[ "${CI}" == "true" ]] && [[ "${ci_log}" != "" ]]; then
if [[ "${CI}" == "true" ]] && [[ "${ci_log}" != "" ]] && [[ "${skip_ci_special:-"no"}" != "yes" ]]; then
echo -e "::${ci_log} ::" "${1} ${2}" | sed 's/\x1b\[[0-9;]*m//g' >&2
fi

View File

@@ -108,7 +108,8 @@ function run_cleanup_handlers() {
return 0 # No handlers set, just return.
else
if [[ ${cleanup_exit_code:-0} -gt 0 ]]; then
display_alert "Cleaning up" "please wait for cleanups to finish" "error"
# No use polluting GHA/CI with notices about cleanup, if we're already failing. skip_ci_special="yes"
skip_ci_special="yes" display_alert "Cleaning up" "please wait for cleanups to finish" "error"
else
display_alert "Cleaning up" "please wait for cleanups to finish" "info"
fi