diff mbox series

[ovs-dev] ci: Do not dump logs on error for GitHub Actions.

Message ID 20210713121753.1146-1-david.marchand@redhat.com
State Accepted
Headers show
Series [ovs-dev] ci: Do not dump logs on error for GitHub Actions. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot success github build: passed

Commit Message

David Marchand July 13, 2021, 12:17 p.m. UTC
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 <david.marchand@redhat.com>
---
Note:
I could do only little checks on Travis by lack of credits.
OSX change is untested but is done nevertheless for consistency sake.
ARM jobs pass fine.
---
 .ci/linux-build.sh | 27 +++++++++++++++++++--------
 .ci/osx-build.sh   | 30 +++++++++++++++++++-----------
 2 files changed, 38 insertions(+), 19 deletions(-)

Comments

Aaron Conole July 13, 2021, 5:22 p.m. UTC | #1
David Marchand <david.marchand@redhat.com> writes:

> 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 <david.marchand@redhat.com>
> ---
> Note:
> I could do only little checks on Travis by lack of credits.
> OSX change is untested but is done nevertheless for consistency sake.
> ARM jobs pass fine.
> ---

Magnifique!

Signed-off-by: Aaron Conole <aconole@redhat.com>
Aaron Conole July 13, 2021, 5:23 p.m. UTC | #2
David Marchand <david.marchand@redhat.com> writes:

> 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 <david.marchand@redhat.com>
> ---
> Note:
> I could do only little checks on Travis by lack of credits.
> OSX change is untested but is done nevertheless for consistency sake.
> ARM jobs pass fine.
> ---

Sorry, I pressed the wrong tagging key.

Acked-by: Aaron Conole <aconole@redhat.com>
Ilya Maximets July 16, 2021, 1:14 p.m. UTC | #3
On 7/13/21 7:23 PM, Aaron Conole wrote:
> David Marchand <david.marchand@redhat.com> writes:
> 
>> 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 <david.marchand@redhat.com>
>> ---
>> Note:
>> I could do only little checks on Travis by lack of credits.
>> OSX change is untested but is done nevertheless for consistency sake.
>> ARM jobs pass fine.
>> ---
> 
> Sorry, I pressed the wrong tagging key.
> 
> Acked-by: Aaron Conole <aconole@redhat.com>
> 

Thanks, David and Aaron!  Applied.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 0210d6a77e..863f023888 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 bf2c13fa3c..f8facebeb0 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