forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[build] Add retry when make SONiC image to improve success rate. (son…
…ic-net#12325) Why I did it Makefile needs some dependencies from the Internet. It will fail for network related issue. Retries will fix most of these issues. How I did it Add retries when running commands which maybe related with networking. How to verify it
- Loading branch information
1 parent
56d3649
commit d9a2bc8
Showing
3 changed files
with
27 additions
and
3 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,6 @@ | ||
variables: | ||
DEFAULT_CONTAINER_REGISTRY: 'publicmirror.azurecr.io' | ||
COMMON_LIB_BUILD_ENVS: 'bullseye' | ||
SONIC_SLAVE_DOCKER_DRIVER: 'overlay2' | ||
SONIC_BUILD_RETRY_COUNT: 3 | ||
SONIC_BUILD_RETRY_INTERVAL: 600 |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
run_with_retry(){ | ||
[ "$SONIC_BUILD_RETRY_COUNT" -gt 0 ] || SONIC_BUILD_RETRY_COUNT=0 | ||
[[ "$*" == "" ]] && { echo "run_with_retry: input command can't be empty." 1>&2;exit 1; } | ||
for ((i=0; i<=$SONIC_BUILD_RETRY_COUNT; i++)) | ||
do | ||
if [[ $i != 0 ]];then | ||
echo "==============================================================================" 1>&2 | ||
echo "Waiting $SONIC_BUILD_RETRY_INTERVAL to run again, $i/$SONIC_BUILD_RETRY_COUNT" 1>&2 | ||
echo "==============================================================================" 1>&2 | ||
sleep $SONIC_BUILD_RETRY_INTERVAL | ||
fi | ||
"$@" && break | ||
done | ||
} | ||
run_with_retry "$@" |