Skip to content

Commit

Permalink
ci: retry rsync
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Nov 10, 2023
1 parent fe46514 commit 31ce455
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions ci/apps/tasks/run-on-nix-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,25 @@ gcloud compute start-iap-tunnel "${host_name}" --zone="${host_zone}" --project="
tunnel_pid="$!"
trap 'jobs -p | xargs kill' EXIT

rsync -avr --delete --exclude="buck-out/**" \
-e "ssh -o StrictHostKeyChecking=no -i ${CI_ROOT}/login.ssh -p 2222" "${REPO_PATH}/" "${login_user}@localhost:${REPO_PATH}"
# Retry loop with a 1-second sleep to wait for the rsync command to succeed
rsync_ready=false
for i in {1..30}; do
rsync -avr --delete --exclude="buck-out/**" \
-e "ssh -o StrictHostKeyChecking=no -i ${CI_ROOT}/login.ssh -p 2222" \
"${REPO_PATH}/" \
"${login_user}@localhost:${REPO_PATH}" && {
rsync_ready=true
break
} || {
echo "rsync command failed, retrying in 1 second (attempt $i/30)..."
sleep 1
}
done

if [ "$rsync_ready" = false ]; then
echo "rsync command failed after 30 attempts. Exiting."
exit 1
fi

kill "${tunnel_pid}"

Expand Down

0 comments on commit 31ce455

Please sign in to comment.