From 3d2575639d22b432d42f6c0807dfeae9f1dc37be Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Thu, 20 Apr 2023 18:04:28 +0200 Subject: [PATCH] logging: include Repeat Build Args in markdown/ANSI logs --- lib/functions/logging/export-logs.sh | 2 ++ lib/functions/logging/trap-logging.sh | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/lib/functions/logging/export-logs.sh b/lib/functions/logging/export-logs.sh index 0a6b8f9ef0..30b2a83cfb 100644 --- a/lib/functions/logging/export-logs.sh +++ b/lib/functions/logging/export-logs.sh @@ -38,6 +38,7 @@ function export_markdown_logs() { ### Armbian logs for ${ARMBIAN_BUILD_UUID} #### Armbian build at $(LC_ALL=C LANG=C date) on $(hostname || true) + #### Repeat build: ${repeat_args_string:-""} #### ARGs: \`${ARMBIAN_ORIGINAL_ARGV[@]@Q}\` MARKDOWN_HEADER @@ -119,6 +120,7 @@ function export_ansi_logs() { # Armbian ANSI build logs for ${ARMBIAN_BUILD_UUID} - use "less -SR" to view $(echo -e -n "${bright_blue_color:-}")# Armbian build at $(LC_ALL=C LANG=C date) on $(hostname || true)$(echo -e -n "${ansi_reset_color}") ${dim_line_separator} + $(echo -e -n "${bright_blue_color}")# Repeat build: ${repeat_args_string:-""}$(echo -e -n "${ansi_reset_color}") $(echo -e -n "${bright_blue_color}")# ARGs: ${ARMBIAN_ORIGINAL_ARGV[@]@Q}$(echo -e -n "${ansi_reset_color}") ${dim_line_separator} ANSI_HEADER diff --git a/lib/functions/logging/trap-logging.sh b/lib/functions/logging/trap-logging.sh index a4960a7123..f8ac705cd4 100644 --- a/lib/functions/logging/trap-logging.sh +++ b/lib/functions/logging/trap-logging.sh @@ -68,6 +68,11 @@ function trap_handler_cleanup_logging() { display_alert "Not archiving old logs." "CI=${CI:-false}, SKIP_LOG_ARCHIVE=${SKIP_LOG_ARCHIVE:-no}" "debug" fi + # Gather repeat build args, included in the logs. + declare -g repeat_args=() + produce_repeat_args_array # produces repeat_args + declare repeat_args_string="${repeat_args[*]}" + ## Here -- we need to definitely stop logging, cos we're gonna consolidate and delete the logs. display_alert "End of logging" "STOP LOGGING: CURRENT_LOGFILE: ${CURRENT_LOGFILE}" "debug" @@ -110,5 +115,7 @@ function trap_handler_cleanup_logging() { cat "${markdown_log_file}" >> "${GITHUB_STEP_SUMMARY}" || true fi + unset repeat_args_string + discard_logs_tmp_dir }