From 526dfb8936927ddddf73c2677ff581a5452f7838 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Wed, 15 Mar 2023 15:31:45 -0600 Subject: [PATCH] logformatter: futureproof output filename "Just this once", I thought, adding an obscure unmaintainable duplication to the CI code. When will I learn? This fixes the logformatter output filename to handle boltdb/sqlite. Signed-off-by: Ed Santiago --- contrib/cirrus/runner.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh index cfcebccd14..78ff6ecea5 100755 --- a/contrib/cirrus/runner.sh +++ b/contrib/cirrus/runner.sh @@ -345,15 +345,25 @@ function _run_gitlab() { return $ret } -logformatter() { +# Name pattern for logformatter output file, derived from environment +function output_name() { + # .cirrus.yml defines this as a short readable string for web UI + std_name_fmt=$(sed -ne 's/^.*std_name_fmt \"\(.*\)\"/\1/p' <.cirrus.yml) + test -n "$std_name_fmt" || die "Could not grep 'std_name_fmt' from .cirrus.yml" + + # Interpolate envariables. 'set -u' throws fatal if any are undefined + ( + set -u + eval echo "$std_name_fmt" | tr ' ' '-' + ) +} + +function logformatter() { if [[ "$CI" == "true" ]]; then - # Use similar format as human-friendly task name from .cirrus.yml - # shellcheck disable=SC2154 - output_name="$TEST_FLAVOR-$PODBIN_NAME-$DISTRO_NV-$PRIV_NAME-$TEST_ENVIRON" # Requires stdin and stderr combined! cat - \ |& awk --file "${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/timestamp.awk" \ - |& "${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/logformatter" "$output_name" + |& "${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/logformatter" "$(output_name)" else # Assume script is run by a human, they want output immediately cat -