diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2023-01-18 06:26:58 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2023-01-19 03:49:57 +0530 |
commit | 6a7d4c4a3f8b8b0af00aa312c4bd843bd1b03cea (patch) | |
tree | ce117d9de9df630bf4db478815e93ad1c31164a7 /ci | |
parent | 15a164078a43c426a2a644820110492a08b34f1f (diff) |
ci: Fix spurious errors while building iOS / Android examples
Run the build scripts through a shell script that checks the output
and retries if the error was a known spurious error.
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1076>
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/run_retry.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ci/run_retry.sh b/ci/run_retry.sh new file mode 100755 index 00000000..9105c9cc --- /dev/null +++ b/ci/run_retry.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# vim: set sts=4 sw=4 et : + +set -o pipefail + +ERRORS=( + "Warning: An error occurred while preparing SDK package Android SDK Tools: Connection reset." + "The Xcode build system has crashed. Build again to continue." +) +RETRIES=3 +LOGFILE="/tmp/logfile.txt" + +while true; do + spurious_error= + "$@" | tee "$LOGFILE" 2>&1 + ret=$? + [[ $ret == 0 ]] && break + while read line; do + for error in "${ERRORS[@]}"; do + if [[ $line =~ $error ]]; then + spurious_error=$line + break 2 + fi + done + done < "$LOGFILE" + rm -f "$LOGFILE" + if [[ $spurious_error == '' ]] || [[ $RETRIES == 0 ]]; then + exit $ret + fi + RETRIES=$((RETRIES-1)) + echo "Retrying, caught spurious failure: $spurious_error" +done |