-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a retry function for all packages that can support it.
- Loading branch information
Showing
19 changed files
with
371 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
function can_retry(){ | ||
local TRY_AGAIN_REASON=('Library not loaded: @rpath/') | ||
for reason in "${TRY_AGAIN_REASON[@]}"; do | ||
if [[ $(grep -c "${reason}" "${1}") -ge 1 ]]; then | ||
return 1 | ||
fi | ||
done | ||
return 0 | ||
} | ||
function no_exit_failure(){ | ||
set +e | ||
( | ||
set -o pipefail | ||
do_build 2>&1 | tee -a "${SRC_DIR}"/output.log | ||
) | ||
} | ||
function retry_build(){ | ||
while true; do | ||
if no_exit_failure; then | ||
set -e | ||
break | ||
elif can_retry "${SRC_DIR}"/output.log; then | ||
tail -600 "${SRC_DIR}"/output.log && exit 1 | ||
elif [[ ${try_count} -gt 1 ]]; then | ||
tail -50 "${SRC_DIR}"/output.log | ||
(( try_count++ )) || true | ||
printf "Exhausted retry attempts: %s\n" "${try_count}" | ||
exit 1 | ||
fi | ||
(( try_count++ )) || true | ||
tail -100 output.log | ||
printf "\n\nRoutine error caught, trying again...\n" | ||
true > "${SRC_DIR}"/output.log | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ package: | |
|
||
source: | ||
- path: ../../../moose | ||
- path: ../functions/retry_build.sh | ||
|
||
build: | ||
number: 0 | ||
|
Oops, something went wrong.