From 6c41bcb138b359b075e2c243a32fb68f095fcc91 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Tue, 13 Jul 2021 14:17:53 +0200 Subject: [PATCH] ci: Do not dump logs on error for GitHub Actions. GHA webui directly focus on the last lines for a failing step. config and testsuite logs are attached as artifacts in GHA in case of failures, so dumping them just adds noise. Skip dumping those files. Travis is left untouched though Signed-off-by: David Marchand Acked-by: Aaron Conole Signed-off-by: Ilya Maximets --- .ci/linux-build.sh | 27 +++++++++++++++++++-------- .ci/osx-build.sh | 30 +++++++++++++++++++----------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh index 0210d6a77e8..863f0238882 100755 --- a/.ci/linux-build.sh +++ b/.ci/linux-build.sh @@ -7,6 +7,21 @@ CFLAGS_FOR_OVS="-g -O2" SPARSE_FLAGS="" EXTRA_OPTS="--enable-Werror" +on_exit() { + if [ $? = 0 ]; then + exit + fi + FILES_TO_PRINT="config.log" + FILES_TO_PRINT="$FILES_TO_PRINT */_build/sub/tests/testsuite.log" + + for pr_file in $FILES_TO_PRINT; do + cat "$pr_file" 2>/dev/null + done +} +# We capture the error logs as artifacts in Github Actions, no need to dump +# them via a EXIT handler. +[ -n "$GITHUB_WORKFLOW" ] || trap on_exit EXIT + function install_kernel() { if [[ "$1" =~ ^5.* ]]; then @@ -163,7 +178,7 @@ function install_dpdk() function configure_ovs() { ./boot.sh - ./configure CFLAGS="${CFLAGS_FOR_OVS}" $* || { cat config.log; exit 1; } + ./configure CFLAGS="${CFLAGS_FOR_OVS}" $* } function build_ovs() @@ -180,7 +195,7 @@ function build_ovs() make -j4 popd else - make -j4 || { cat config.log; exit 1; } + make -j4 fi } @@ -244,12 +259,8 @@ if [ "$TESTSUITE" ]; then configure_ovs export DISTCHECK_CONFIGURE_FLAGS="$OPTS" - if ! make distcheck -j4 CFLAGS="${CFLAGS_FOR_OVS}" \ - TESTSUITEFLAGS=-j4 RECHECK=yes; then - # testsuite.log is necessary for debugging. - cat */_build/sub/tests/testsuite.log - exit 1 - fi + make distcheck -j4 CFLAGS="${CFLAGS_FOR_OVS}" \ + TESTSUITEFLAGS=-j4 RECHECK=yes else if [ -z "${KERNEL_LIST}" ]; then build_ovs ${KERNEL}; else diff --git a/.ci/osx-build.sh b/.ci/osx-build.sh index bf2c13fa3c1..f8facebeb02 100755 --- a/.ci/osx-build.sh +++ b/.ci/osx-build.sh @@ -5,6 +5,21 @@ set -o errexit CFLAGS="-Werror $CFLAGS" EXTRA_OPTS="" +on_exit() { + if [ $? = 0 ]; then + exit + fi + FILES_TO_PRINT="config.log" + FILES_TO_PRINT="$FILES_TO_PRINT */_build/sub/tests/testsuite.log" + + for pr_file in $FILES_TO_PRINT; do + cat "$pr_file" 2>/dev/null + done +} +# We capture the error logs as artifacts in Github Actions, no need to dump +# them via a EXIT handler. +[ -n "$GITHUB_WORKFLOW" ] || trap on_exit EXIT + function configure_ovs() { ./boot.sh && ./configure $* @@ -13,20 +28,13 @@ function configure_ovs() configure_ovs $EXTRA_OPTS $* if [ "$CC" = "clang" ]; then - set make CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument" + make CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument" else - set make CFLAGS="$CFLAGS $BUILD_ENV" -fi -if ! "$@"; then - cat config.log - exit 1 + make CFLAGS="$CFLAGS $BUILD_ENV" fi + if [ "$TESTSUITE" ] && [ "$CC" != "clang" ]; then - if ! make distcheck RECHECK=yes; then - # testsuite.log is necessary for debugging. - cat */_build/sub/tests/testsuite.log - exit 1 - fi + make distcheck RECHECK=yes fi exit 0