Skip to content
Snippets Groups Projects
Commit 3368f77f authored by Tamara Vazquez Schroeder's avatar Tamara Vazquez Schroeder Committed by Atlas Nightlybuild
Browse files

Merge branch 'checkout-retry-ATLINFR-1817-21.X' into '21.0'

Retry mechanism in checkout_atlasexternals.sh and checkout_Gaudi.sh (ATLINFR-1817) -> 21.X branches

See merge request !5537

Former-commit-id: 310e28b343767e5124f71c6e092534156049e3b2
parent 8250634c
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,22 @@ usage() {
echo " in the source directory is left untouched."
}
_max_retry_=5
_retry_ () {
local cmd="$*"
local n=0
while ! $cmd ; do
if test $n -eq $_max_retry_ ; then
echo "ERROR: $cmd FAILED $_max_retry_ times. EXIT(1)" >&2
exit 1
fi
echo "WARNING: $cmd FAILED, retry in 30 sec ... "
sleep 30s
n=`expr $n + 1`
done
}
# Parse the command line arguments:
TAGBRANCH=""
SOURCEDIR=""
......@@ -86,12 +102,12 @@ echo " from: $GAUDIURL"
if [ ! -d "${SOURCEDIR}" ]; then
# Clone the repository:
git clone ${GAUDIURL} ${SOURCEDIR}
_retry_ git clone ${GAUDIURL} ${SOURCEDIR}
else
echo "${SOURCEDIR} already exists -> assume previous checkout"
fi
# Get the appropriate version of it:
cd ${SOURCEDIR}
git fetch --prune origin
git checkout -f ${TAGBRANCH}
_retry_ git fetch --prune origin
_retry_ git checkout -f ${TAGBRANCH}
......@@ -27,6 +27,22 @@ usage() {
echo " in the source directory is left untouched."
}
_max_retry_=5
_retry_ () {
local cmd="$*"
local n=0
while ! $cmd ; do
if test $n -eq $_max_retry_ ; then
echo "ERROR: $cmd FAILED $_max_retry_ times. EXIT(1)" >&2
exit 1
fi
echo "WARNING: $cmd FAILED, retry in 30 sec ... "
sleep 30s
n=`expr $n + 1`
done
}
# Parse the command line arguments:
TAGBRANCH=""
SOURCEDIR=""
......@@ -86,12 +102,12 @@ echo " from: $EXTERNALSURL"
if [ ! -d "${SOURCEDIR}" ]; then
# Clone the repository:
git clone ${EXTERNALSURL} ${SOURCEDIR}
_retry_ git clone ${EXTERNALSURL} ${SOURCEDIR}
else
echo "${SOURCEDIR} already exists -> assume previous checkout"
fi
# Get the appropriate version of it:
cd ${SOURCEDIR}
git fetch --prune origin
git checkout -f ${TAGBRANCH}
_retry_ git fetch --prune origin
_retry_ git checkout -f ${TAGBRANCH}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment