From d7831b2374d96c4423dc4442fa16061360b53314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A2ni=20Marques?= Date: Sun, 19 Jul 2026 04:09:35 +0200 Subject: [PATCH] release 1.13.10: global SUMMARY at end of multi-phase runs Persist GLOBAL_PASS/FAIL/WARN/INFO/BLOCK in TALER_MON_STATE across check_*.sh processes. Multi-phase never prints a phase SUMMARY box (only ERRORS/BLOCKERS mid-run); parent progress_finish + summary_global prints one whole-run totals stand after all phases. --- VERSION | 2 +- VERSIONS.md | 1 + lib.sh | 191 +++++++++++++++++++++++++++++--------------- taler-monitoring.sh | 18 +++-- 4 files changed, 139 insertions(+), 73 deletions(-) diff --git a/VERSION b/VERSION index 084f226..f3352b3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.13.9 +1.13.10 diff --git a/VERSIONS.md b/VERSIONS.md index b7cd3f3..75b337c 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -17,6 +17,7 @@ Git tags: `vMAJOR.FEATURE.FIX` (e.g. `v1.8.0`). File `VERSION` omits the `v` pre | Tag | Date (UTC) | Notes | |-----|------------|--------| +| **v1.13.10** | 2026-07-19 | **Bugfix:** multi-phase runs print **one global SUMMARY** at parent end (aggregated OK/ERROR/WARN/INFO/BLOCK via `TALER_MON_STATE`); no phase SUMMARY at all (not even last phase); mid-phase still lists ERRORS/BLOCKERS; solo `check_*.sh` unchanged. | | **v1.13.9** | 2026-07-19 | **Bugfix:** no mid-run SUMMARY / progress standings between phases (no more 34/52 + SUMMARY after urls while monpages still runs); full stand only on last phase or solo check script; `progress_finish` remains. | | **v1.13.8** | 2026-07-19 | **Bugfix:** monpages **TOP** meta/marker failures (missing generated/version-link/taler-mon-page, empty race body) are **WARN only** — no longer self-red the run; optional `MONPAGES_TOP_STRICT=1` restores ERROR. | | **v1.13.7** | 2026-07-19 | **Bugfix:** move optional/meta scripts under `meta/` (deprecated mail/mm units, firecuda outside-runner, legacy multi-host site-gen); production path stays host-agent + `site-gen/console_to_html.py`. | diff --git a/lib.sh b/lib.sh index 565a148..560216c 100755 --- a/lib.sh +++ b/lib.sh @@ -527,7 +527,13 @@ TEST_GROUP="" TEST_N=0 LAST_TID="" # Global / progress: may continue across check_*.sh processes via TALER_MON_STATE +# GLOBAL_*_N = whole-run status totals (multi-phase summary at parent end) GLOBAL_N="${GLOBAL_N:-0}" +GLOBAL_PASS_N="${GLOBAL_PASS_N:-0}" +GLOBAL_FAIL_N="${GLOBAL_FAIL_N:-0}" +GLOBAL_WARN_N="${GLOBAL_WARN_N:-0}" +GLOBAL_INFO_N="${GLOBAL_INFO_N:-0}" +GLOBAL_BLOCK_N="${GLOBAL_BLOCK_N:-0}" LAST_GLOBAL="" PROGRESS_DONE="${PROGRESS_DONE:-0}" PROGRESS_TOTAL="${PROGRESS_TOTAL:-0}" @@ -537,14 +543,28 @@ _mon_state_load() { [ -n "${TALER_MON_STATE:-}" ] && [ -f "${TALER_MON_STATE}" ] || return 0 # shellcheck disable=SC1090 . "${TALER_MON_STATE}" + : "${GLOBAL_N:=0}" + : "${GLOBAL_PASS_N:=0}" + : "${GLOBAL_FAIL_N:=0}" + : "${GLOBAL_WARN_N:=0}" + : "${GLOBAL_INFO_N:=0}" + : "${GLOBAL_BLOCK_N:=0}" + : "${PROGRESS_DONE:=0}" + : "${PROGRESS_TOTAL:=0}" + : "${PROGRESS_LAST_SHOWN:=0}" } _mon_state_save() { [ -n "${TALER_MON_STATE:-}" ] || return 0 { - printf 'GLOBAL_N=%s\n' "$GLOBAL_N" - printf 'PROGRESS_DONE=%s\n' "$PROGRESS_DONE" - printf 'PROGRESS_TOTAL=%s\n' "$PROGRESS_TOTAL" - printf 'PROGRESS_LAST_SHOWN=%s\n' "$PROGRESS_LAST_SHOWN" + printf 'GLOBAL_N=%s\n' "${GLOBAL_N:-0}" + printf 'GLOBAL_PASS_N=%s\n' "${GLOBAL_PASS_N:-0}" + printf 'GLOBAL_FAIL_N=%s\n' "${GLOBAL_FAIL_N:-0}" + printf 'GLOBAL_WARN_N=%s\n' "${GLOBAL_WARN_N:-0}" + printf 'GLOBAL_INFO_N=%s\n' "${GLOBAL_INFO_N:-0}" + printf 'GLOBAL_BLOCK_N=%s\n' "${GLOBAL_BLOCK_N:-0}" + printf 'PROGRESS_DONE=%s\n' "${PROGRESS_DONE:-0}" + printf 'PROGRESS_TOTAL=%s\n' "${PROGRESS_TOTAL:-0}" + printf 'PROGRESS_LAST_SHOWN=%s\n' "${PROGRESS_LAST_SHOWN:-0}" } >"${TALER_MON_STATE}" } _mon_state_load @@ -783,6 +803,8 @@ ok() { _take_tid _msg_line "$BG_OK" "OK" "$G" "$label" "$detail" PASS_N=$((PASS_N + 1)) + GLOBAL_PASS_N=$((GLOBAL_PASS_N + 1)) + _mon_state_save } # component-scoped error: err bank "what failed" "why / HTTP / path" err() { @@ -790,7 +812,9 @@ err() { _take_tid _msg_line "$BG_ERR" "ERROR" "$R" "${comp}: ${msg}" "$detail" FAIL_N=$((FAIL_N + 1)) + GLOBAL_FAIL_N=$((GLOBAL_FAIL_N + 1)) ERRORS+=("${LAST_TID:+$LAST_TID }[$comp] $msg${detail:+ · $detail}") + _mon_state_save } # fail "what failed" ["why / HTTP code / path"] fail() { @@ -798,7 +822,9 @@ fail() { _take_tid _msg_line "$BG_ERR" "ERROR" "$R" "$label" "$detail" FAIL_N=$((FAIL_N + 1)) + GLOBAL_FAIL_N=$((GLOBAL_FAIL_N + 1)) ERRORS+=("${LAST_TID:+$LAST_TID }$label${detail:+ · $detail}") + _mon_state_save } warn() { # warn "what is soft-bad" ["why still ok to continue"] @@ -819,6 +845,8 @@ warn() { fi _msg_line "$BG_WARN" "WARN" "$Y" "$head" "$detail" WARN_N=$((WARN_N + 1)) + GLOBAL_WARN_N=$((GLOBAL_WARN_N + 1)) + _mon_state_save } info() { # info "topic" ["concrete fact / value / next step"] @@ -826,6 +854,8 @@ info() { _take_tid _msg_line "$BG_INFO" "INFO" "$C" "$label" "$detail" INFO_N=$((INFO_N + 1)) + GLOBAL_INFO_N=$((GLOBAL_INFO_N + 1)) + _mon_state_save } blocker() { # Hard stop on pay/withdraw path: blocker "step" "why it cannot continue" @@ -834,7 +864,10 @@ blocker() { _msg_line "$BG_BLK" "BLOCKER" "$M" "${step}" "$msg" BLOCKERS+=("${LAST_TID:+$LAST_TID }[$step] $msg") FAIL_N=$((FAIL_N + 1)) + GLOBAL_FAIL_N=$((GLOBAL_FAIL_N + 1)) + GLOBAL_BLOCK_N=$((GLOBAL_BLOCK_N + 1)) ERRORS+=("BLOCKER ${LAST_TID:+$LAST_TID }[$step] $msg") + _mon_state_save } section() { # Boxed section header (3 lines when colour on) @@ -860,13 +893,94 @@ section() { fi } +# Print SUMMARY totals box for given counts (phase-local or global). +# $1=pass $2=fail $3=warn $4=info $5=block +_summary_totals_box() { + local pass_n="$1" fail_n="$2" warn_n="$3" info_n="$4" blk_n="$5" + if [ "${BOX:-0}" = "1" ]; then + printf -- '\n%s┌ %s ┐%s\n' "$BG_SEC" "$(i18n_tag SUMMARY)" "$N" + _sum_badge() { # $1=bg $2=tag $3=fg $4=n + local _tg + _tg=$(i18n_tag "$2") + printf -- ' %s┌ %-5s┐%s %s%4d%s\n' "$1" "$_tg" "$N" "$3" "$4" "$N" + } + _sum_badge "$BG_OK" "OK" "$G" "$pass_n" + [ "$fail_n" -gt 0 ] && _sum_badge "$BG_ERR" "ERROR" "$R" "$fail_n" + [ "$warn_n" -gt 0 ] && _sum_badge "$BG_WARN" "WARN" "$Y" "$warn_n" + [ "$info_n" -gt 0 ] && _sum_badge "$BG_INFO" "INFO" "$C" "$info_n" + [ "$blk_n" -gt 0 ] && _sum_badge "$BG_BLK" "BLOCK" "$M" "$blk_n" + else + printf -- '\n[ %s ]\n' "$(i18n_tag SUMMARY)" + printf -- ' [ %-5s ] %s%4d%s\n' "$(i18n_tag OK)" "$G" "$pass_n" "$N" + [ "$fail_n" -gt 0 ] && printf -- ' [ %-5s ] %s%4d%s\n' "$(i18n_tag ERROR)" "$R" "$fail_n" "$N" + [ "$warn_n" -gt 0 ] && printf -- ' [ %-5s ] %s%4d%s\n' "$(i18n_tag WARN)" "$Y" "$warn_n" "$N" + [ "$info_n" -gt 0 ] && printf -- ' [ %-5s ] %s%4d%s\n' "$(i18n_tag INFO)" "$C" "$info_n" "$N" + [ "$blk_n" -gt 0 ] && printf -- ' [ %-5s ] %s%4d%s\n' "$(i18n_tag BLOCK)" "$M" "$blk_n" "$N" + fi + # one-line rollup (bold label, severity-coloured counts) + printf -- ' %stotals:%s %s%d OK%s' "$B" "$N" "$G" "$pass_n" "$N" + [ "$fail_n" -gt 0 ] && printf -- ' · %s%d ERROR%s' "$R" "$fail_n" "$N" + [ "$warn_n" -gt 0 ] && printf -- ' · %s%d WARN%s' "$Y" "$warn_n" "$N" + [ "$info_n" -gt 0 ] && printf -- ' · %s%d INFO%s' "$C" "$info_n" "$N" + [ "$blk_n" -gt 0 ] && printf -- ' · %s%d BLOCKER%s' "$M" "$blk_n" "$N" + printf '\n' + # overall verdict + if [ "$fail_n" -eq 0 ] && [ "$blk_n" -eq 0 ] && [ "$warn_n" -eq 0 ]; then + if [ "${BOX:-0}" = "1" ]; then + printf -- ' %s┌ OK ┐%s %sall clear%s\n' "$BG_OK" "$N" "$G" "$N" + else + printf -- ' %s[ OK ] all clear%s\n' "$G" "$N" + fi + elif [ "$fail_n" -eq 0 ] && [ "$blk_n" -eq 0 ]; then + if [ "${BOX:-0}" = "1" ]; then + printf -- ' %s┌ WARN ┐%s %swarnings only (no hard fail)%s\n' "$BG_WARN" "$N" "$Y" "$N" + else + printf -- ' %s[ WARN ] warnings only (no hard fail)%s\n' "$Y" "$N" + fi + else + local _fail_msg + _fail_msg=$(i18n_text 'failed — see list above') + if [ "${BOX:-0}" = "1" ]; then + printf -- ' %s┌ ERROR ┐%s %s%s%s\n' "$BG_ERR" "$N" "$R" "$_fail_msg" "$N" + else + printf -- ' %s[ ERROR ] %s%s\n' "$R" "$_fail_msg" "$N" + fi + fi +} + +# Whole-run SUMMARY from TALER_MON_STATE (parent after all phases). +# Multi-phase: phases never print SUMMARY totals; only this does. +summary_global() { + _mon_state_load + local pass_n="${GLOBAL_PASS_N:-0}" + local fail_n="${GLOBAL_FAIL_N:-0}" + local warn_n="${GLOBAL_WARN_N:-0}" + local info_n="${GLOBAL_INFO_N:-0}" + local blk_n="${GLOBAL_BLOCK_N:-0}" + # Progress bar + numbered checks already printed by progress_finish when present. + if [ "${GLOBAL_N:-0}" -gt 0 ]; then + if [ "${PROGRESS_TOTAL:-0}" -gt 0 ]; then + printf -- '%s %s #001…#%03d · %d/%d %s%s\n' \ + "$D" "$(i18n_text 'numbered checks:')" "$GLOBAL_N" \ + "${PROGRESS_DONE:-0}" "$PROGRESS_TOTAL" \ + "$(i18n_text '(global done/total)')" "$N" + else + printf -- '%s %s #001…#%03d%s\n' \ + "$D" "$(i18n_text 'numbered checks this run:')" "$GLOBAL_N" "$N" + fi + fi + _summary_totals_box "$pass_n" "$fail_n" "$warn_n" "$info_n" "$blk_n" + [ "$fail_n" -eq 0 ] +} + summary() { local blk_n=${#BLOCKERS[@]} - # Multi-phase runs: no intermediate progress bar / numbered checks / SUMMARY box - # (v1.13.9+). Solo check_*.sh still full summary. Parent sets TALER_MON_MULTI_PHASE=1 - # and only the last phase gets PROGRESS_FINAL=1. Mid-run still lists ERRORS/BLOCKERS. + # Multi-phase runs: never print phase SUMMARY / progress standings (v1.13.10+). + # Parent prints one global SUMMARY via summary_global after progress_finish. + # Solo check_*.sh (TALER_MON_MULTI_PHASE unset/0) still full summary. + # Phase still lists ERRORS/BLOCKERS so mid-run failures stay visible. local _full=1 - if [ "${TALER_MON_MULTI_PHASE:-0}" = "1" ] && [ "${PROGRESS_FINAL:-0}" != "1" ]; then + if [ "${TALER_MON_MULTI_PHASE:-0}" = "1" ]; then _full=0 fi @@ -874,12 +988,6 @@ summary() { if [ "$_full" = "1" ]; then # Progress snapshot — whole-run snap also in progress_finish. if [ "${PROGRESS_OFF:-0}" != "1" ] && [ "${PROGRESS_DONE:-0}" -gt 0 ]; then - if [ "${PROGRESS_FINAL:-0}" = "1" ]; then - if [ "${PROGRESS_TOTAL:-0}" -gt 0 ] && [ "$PROGRESS_DONE" -ne "$PROGRESS_TOTAL" ]; then - PROGRESS_TOTAL=$PROGRESS_DONE - _mon_state_save - fi - fi _progress_rebalance _progress_bar_line "$PROGRESS_DONE" "$PROGRESS_TOTAL" fi @@ -918,58 +1026,13 @@ summary() { done fi - # Coloured totals — only at full/final summary (not mid multi-phase) + # Coloured totals — only at full phase summary (solo script / single-phase) if [ "$_full" != "1" ]; then - return 0 - fi - if [ "${BOX:-0}" = "1" ]; then - printf -- '\n%s┌ %s ┐%s\n' "$BG_SEC" "$(i18n_tag SUMMARY)" "$N" - _sum_badge() { # $1=bg $2=tag $3=fg $4=n - local _tg - _tg=$(i18n_tag "$2") - printf -- ' %s┌ %-5s┐%s %s%4d%s\n' "$1" "$_tg" "$N" "$3" "$4" "$N" - } - _sum_badge "$BG_OK" "OK" "$G" "$PASS_N" - [ "$FAIL_N" -gt 0 ] && _sum_badge "$BG_ERR" "ERROR" "$R" "$FAIL_N" - [ "$WARN_N" -gt 0 ] && _sum_badge "$BG_WARN" "WARN" "$Y" "$WARN_N" - [ "$INFO_N" -gt 0 ] && _sum_badge "$BG_INFO" "INFO" "$C" "$INFO_N" - [ "$blk_n" -gt 0 ] && _sum_badge "$BG_BLK" "BLOCK" "$M" "$blk_n" - else - printf -- '\n[ %s ]\n' "$(i18n_tag SUMMARY)" - printf -- ' [ %-5s ] %s%4d%s\n' "$(i18n_tag OK)" "$G" "$PASS_N" "$N" - [ "$FAIL_N" -gt 0 ] && printf -- ' [ %-5s ] %s%4d%s\n' "$(i18n_tag ERROR)" "$R" "$FAIL_N" "$N" - [ "$WARN_N" -gt 0 ] && printf -- ' [ %-5s ] %s%4d%s\n' "$(i18n_tag WARN)" "$Y" "$WARN_N" "$N" - [ "$INFO_N" -gt 0 ] && printf -- ' [ %-5s ] %s%4d%s\n' "$(i18n_tag INFO)" "$C" "$INFO_N" "$N" - [ "$blk_n" -gt 0 ] && printf -- ' [ %-5s ] %s%4d%s\n' "$(i18n_tag BLOCK)" "$M" "$blk_n" "$N" - fi - # one-line rollup (bold label, severity-coloured counts) - printf -- ' %stotals:%s %s%d OK%s' "$B" "$N" "$G" "$PASS_N" "$N" - [ "$FAIL_N" -gt 0 ] && printf -- ' · %s%d ERROR%s' "$R" "$FAIL_N" "$N" - [ "$WARN_N" -gt 0 ] && printf -- ' · %s%d WARN%s' "$Y" "$WARN_N" "$N" - [ "$INFO_N" -gt 0 ] && printf -- ' · %s%d INFO%s' "$C" "$INFO_N" "$N" - [ "$blk_n" -gt 0 ] && printf -- ' · %s%d BLOCKER%s' "$M" "$blk_n" "$N" - printf '\n' - # overall verdict - if [ "$FAIL_N" -eq 0 ] && [ "$blk_n" -eq 0 ] && [ "$WARN_N" -eq 0 ]; then - if [ "${BOX:-0}" = "1" ]; then - printf -- ' %s┌ OK ┐%s %sall clear%s\n' "$BG_OK" "$N" "$G" "$N" - else - printf -- ' %s[ OK ] all clear%s\n' "$G" "$N" - fi - elif [ "$FAIL_N" -eq 0 ] && [ "$blk_n" -eq 0 ]; then - if [ "${BOX:-0}" = "1" ]; then - printf -- ' %s┌ WARN ┐%s %swarnings only (no hard fail)%s\n' "$BG_WARN" "$N" "$Y" "$N" - else - printf -- ' %s[ WARN ] warnings only (no hard fail)%s\n' "$Y" "$N" - fi - else - _fail_msg=$(i18n_text 'failed — see list above') - if [ "${BOX:-0}" = "1" ]; then - printf -- ' %s┌ ERROR ┐%s %s%s%s\n' "$BG_ERR" "$N" "$R" "$_fail_msg" "$N" - else - printf -- ' %s[ ERROR ] %s%s\n' "$R" "$_fail_msg" "$N" - fi + # Still fail the phase exit when this phase had errors (set -e + trailing summary) + [ "$FAIL_N" -eq 0 ] + return fi + _summary_totals_box "$PASS_N" "$FAIL_N" "$WARN_N" "$INFO_N" "$blk_n" [ "$FAIL_N" -eq 0 ] } diff --git a/taler-monitoring.sh b/taler-monitoring.sh index 435d50d..db83a91 100755 --- a/taler-monitoring.sh +++ b/taler-monitoring.sh @@ -570,12 +570,14 @@ chmod +x "$ROOT"/check_*.sh 2>/dev/null || true ec=0 _phase_idx=0 _n_phases=${#PHASES[@]} -# Suppress mid-run SUMMARY / progress standings when more than one phase +# Suppress all phase SUMMARY / progress standings when more than one phase; +# parent prints one global SUMMARY after progress_finish (v1.13.10+). if [ "$_n_phases" -gt 1 ]; then export TALER_MON_MULTI_PHASE=1 else export TALER_MON_MULTI_PHASE=0 fi +_MON_WAS_MULTI="${TALER_MON_MULTI_PHASE}" while [ "$_phase_idx" -lt "$_n_phases" ]; do p="${PHASES[$_phase_idx]}" if [ "$RUN_TIMED_OUT" = "1" ]; then @@ -591,12 +593,6 @@ while [ "$_phase_idx" -lt "$_n_phases" ]; do _phase_idx=$((_phase_idx + 1)) continue fi - # Only last phase may print full SUMMARY + progress standings - if [ "$((_phase_idx + 1))" -ge "$_n_phases" ]; then - export PROGRESS_FINAL=1 - else - export PROGRESS_FINAL=0 - fi case "$p" in urls) run_phase urls "$ROOT/check_urls.sh" || ec=1 ;; inside) run_phase inside "$ROOT/check_inside.sh" || ec=1 ;; @@ -665,7 +661,7 @@ if [ "$RUN_TIMED_OUT" = "1" ]; then fi # Snap progress bar to real global count (done/total) once for the whole run. -# Reload TALER_MON_STATE — check_*.sh update done/total in a separate process. +# Reload TALER_MON_STATE — check_*.sh update done/total + GLOBAL_*_N in a separate process. if type _mon_state_load >/dev/null 2>&1; then _mon_state_load fi @@ -673,5 +669,11 @@ if type progress_finish >/dev/null 2>&1; then printf '\n' progress_finish fi +# Multi-phase: one global SUMMARY (OK/ERROR/WARN/INFO/BLOCK across all phases). +# Single-phase already printed phase-local SUMMARY via check_*.sh. +if [ "${_MON_WAS_MULTI:-0}" = "1" ] && type summary_global >/dev/null 2>&1; then + summary_global || true +fi +unset _MON_WAS_MULTI 2>/dev/null || true exit "$ec"