This is an automated email from the ASF dual-hosted git repository.

mapohl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 6ca9ec7be95fc037698546cb5c8bf7691acf60b1
Author: Matthias Pohl <[email protected]>
AuthorDate: Tue Feb 6 16:23:31 2024 +0100

    [hotfix][build] Fixes error message when printing the 15 biggest directories
---
 .../test-scripts/test-runner-common.sh             | 28 +++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/flink-end-to-end-tests/test-scripts/test-runner-common.sh 
b/flink-end-to-end-tests/test-scripts/test-runner-common.sh
index 662a91a7888..89bc1ccfd16 100644
--- a/flink-end-to-end-tests/test-scripts/test-runner-common.sh
+++ b/flink-end-to-end-tests/test-scripts/test-runner-common.sh
@@ -119,7 +119,16 @@ function log_environment_info {
     df -h
 
     echo "##[group]Top 15 biggest directories in terms of used disk space"
-    du -a . | sort -n -r | head -n 15
+    local pipefail_config
+    pipefail_config="$(get_current_set_option pipefail)"
+
+    # GitHub Actions runs with pipefail enabled which makes
+    # the piped command fail (because head will exit with 141)
+    set +o pipefail
+
+    du -ah --exclude="proc" -t100M . | sort -h -r | head -n 15
+
+    eval "set ${pipefail_config}o pipefail"
 
     if sudo -n true 2>/dev/null; then
       echo "Allocated ports"
@@ -133,6 +142,23 @@ function log_environment_info {
     echo "##[endgroup]"
 }
 
+# The echo'd character can be used to reset the config parameter
+# to it's initial state again, e.g.:
+# sign="$(get_current_set_option pipefail)
+# set -o pipefail
+# set ${sign}o pipefail
+function get_current_set_option {
+    if [ $# -eq 0 ]; then
+      echo "[ERROR] No parameter was specified for get_current_set_option."
+      exit 1
+    elif [ "$(set -o | grep "$1" | grep -c "on$")" -eq 1 ]; then
+      # set -o
+      echo "-"
+    else
+      echo "+"
+    fi
+}
+
 # Shuts down cluster and reverts changes to cluster configs
 function cleanup_proc {
     shutdown_all

Reply via email to