Skip to content

Commit

Permalink
helpers: repo_sync: don't use the operator &&
Browse files Browse the repository at this point in the history
Because we run the script with set -e
Any return value other than 0 causes the process to abort.

Using the operator && causes the script to abort because when
the command fails there is no path to follow.
If we use the if clause operator we solve the problem.

Signed-off-by: Jose Quaresma <[email protected]>
  • Loading branch information
quaresmajose authored and doanac committed Nov 19, 2024
1 parent bddafc0 commit 89af5c9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,22 @@ function repo_sync {
fi
_repo_extra_args=""
for i in $(seq 4); do
run repo init $_repo_extra_args --repo-rev=v2.35 --no-clone-bundle -u $* ${REPO_INIT_OVERRIDES} && break
if run repo init $_repo_extra_args --repo-rev=v2.35 --no-clone-bundle -u $* ${REPO_INIT_OVERRIDES}; then
break
fi
_repo_extra_args="--verbose"
status "repo init failed with error $?"
[ $i -eq 4 ] && exit 1
if [ $i -eq 4 ]; then
exit 1
fi
status "sleeping and trying again"
sleep $(($i*2))
done
_repo_extra_args=""
for i in $(seq 4); do
run timeout 4m repo sync $_repo_extra_args && break
if run timeout 4m repo sync $_repo_extra_args; then
break
fi
_repo_extra_args="--verbose"
if [ $? -eq 124 ] ; then
msg="Command timed out"
Expand Down

0 comments on commit 89af5c9

Please sign in to comment.