Skip to content

Commit 89af5c9

Browse files
quaresmajosedoanac
authored andcommitted
helpers: repo_sync: don't use the operator &&
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 <jose.quaresma@foundries.io>
1 parent bddafc0 commit 89af5c9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

helpers.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,22 @@ function repo_sync {
7676
fi
7777
_repo_extra_args=""
7878
for i in $(seq 4); do
79-
run repo init $_repo_extra_args --repo-rev=v2.35 --no-clone-bundle -u $* ${REPO_INIT_OVERRIDES} && break
79+
if run repo init $_repo_extra_args --repo-rev=v2.35 --no-clone-bundle -u $* ${REPO_INIT_OVERRIDES}; then
80+
break
81+
fi
8082
_repo_extra_args="--verbose"
8183
status "repo init failed with error $?"
82-
[ $i -eq 4 ] && exit 1
84+
if [ $i -eq 4 ]; then
85+
exit 1
86+
fi
8387
status "sleeping and trying again"
8488
sleep $(($i*2))
8589
done
8690
_repo_extra_args=""
8791
for i in $(seq 4); do
88-
run timeout 4m repo sync $_repo_extra_args && break
92+
if run timeout 4m repo sync $_repo_extra_args; then
93+
break
94+
fi
8995
_repo_extra_args="--verbose"
9096
if [ $? -eq 124 ] ; then
9197
msg="Command timed out"

0 commit comments

Comments
 (0)