@@ -144,6 +144,30 @@ if [ $FETCH_STAGE -eq 1 ] ; then
144
144
fi
145
145
gh_hash=` $SSH_CMD $SSH_HOST_X86 " cd rspamd ; git rev-parse --short HEAD" `
146
146
147
+ retry_rsync () {
148
+ local RETRY_INTERVAL=5
149
+ local MAX_ATTEMPTS=100
150
+ local attempt=0
151
+
152
+ while true ; do
153
+ rsync " $@ "
154
+
155
+ local RSYNC_EXIT_CODE=$?
156
+
157
+ if [ $RSYNC_EXIT_CODE -eq 0 ]; then
158
+ return 0
159
+ fi
160
+
161
+ if [ " $attempt " -ge " $MAX_ATTEMPTS " ]; then
162
+ exit 1
163
+ fi
164
+
165
+ attempt=$(( attempt + 1 ))
166
+ sleep $RETRY_INTERVAL
167
+ done
168
+ }
169
+
170
+
147
171
build_rspamd_deb () {
148
172
HOST=$1
149
173
DISTNAME=$2
@@ -204,6 +228,7 @@ if [ ${DIST} -ne 0 ] ; then
204
228
fi
205
229
206
230
if [ $BUILD_STAGE -eq 1 ] ; then
231
+ rm -fr ${TARGET_DIR}
207
232
mkdir -p ${TARGET_DIR}
208
233
if [ -n " ${STABLE} " ] ; then
209
234
_version=" ${STABLE_VER} "
@@ -305,10 +330,10 @@ EOD
305
330
# Copy old packages remaining to include them into the repo
306
331
if [ ${NO_DELETE} -eq 0 ] ; then
307
332
if [ -n " ${STABLE} " ] ; then
308
- rsync -e " ssh -i ${SSH_KEY_DEB_STABLE} " --ignore-existing ${RSYNC_ARGS} \
333
+ retry_rsync -e " ssh -i ${SSH_KEY_DEB_STABLE} " --ignore-existing ${RSYNC_ARGS} \
309
334
${UPLOAD_HOST} :${UPLOAD_SUFFIX}${TARGET_DEB_STABLE} /* ${TARGET_DIR} /repos/
310
335
else
311
- rsync -e " ssh -i ${SSH_KEY_DEB_UNSTABLE} " --ignore-existing ${RSYNC_ARGS} \
336
+ retry_rsync -e " ssh -i ${SSH_KEY_DEB_UNSTABLE} " --ignore-existing ${RSYNC_ARGS} \
312
337
${UPLOAD_HOST} :${UPLOAD_SUFFIX}${TARGET_DEB_UNSTABLE} /* ${TARGET_DIR} /repos/
313
338
fi
314
339
fi
330
355
reprepro -P extra -S debug -b $_repodir -v --keepunreferencedfiles includedeb $_distname $deb_pkg
331
356
done
332
357
for deb_dsc in ${TARGET_DIR} /$d /rspamd_* .dsc ; do
333
- reprepro -P extra -S mail -b $_repodir -v --keepunreferencedfiles includedsc $_distname
358
+ reprepro -P extra -S mail -b $_repodir -v --keepunreferencedfiles includedsc $_distname $deb_dsc
334
359
done
335
360
336
361
debsign --re-sign -k $KEY ${TARGET_DIR} /$d /rspamd_* .changes
@@ -354,10 +379,10 @@ EOD
354
379
# Copy old stuff
355
380
if [ ${NO_DELETE} -eq 0 ] ; then
356
381
if [ -n " ${STABLE} " ] ; then
357
- rsync -e " ssh -i ${SSH_KEY_RPM_STABLE} " ${RSYNC_ARGS} --ignore-existing \
382
+ retry_rsync -e " ssh -i ${SSH_KEY_RPM_STABLE} " ${RSYNC_ARGS} --ignore-existing \
358
383
${UPLOAD_HOST} :${UPLOAD_SUFFIX}${TARGET_RPM_STABLE} /$d /* ${TARGET_DIR} /rpm/$d /
359
384
else
360
- rsync -e " ssh -i ${SSH_KEY_RPM_UNSTABLE} " ${RSYNC_ARGS} --ignore-existing \
385
+ retry_rsync -e " ssh -i ${SSH_KEY_RPM_UNSTABLE} " ${RSYNC_ARGS} --ignore-existing \
361
386
${UPLOAD_HOST} :${UPLOAD_SUFFIX}${TARGET_RPM_UNSTABLE} /$d /* ${TARGET_DIR} /rpm/$d /
362
387
fi
363
388
fi
@@ -421,21 +446,21 @@ if [ ${UPLOAD_STAGE} -eq 1 ] ; then
421
446
422
447
if [ $DEBIAN -ne 0 ] ; then
423
448
if [ -n " ${STABLE} " ] ; then
424
- rsync -e " ssh -i ${SSH_KEY_DEB_STABLE} " ${RSYNC_ARGS} \
449
+ retry_rsync -e " ssh -i ${SSH_KEY_DEB_STABLE} " ${RSYNC_ARGS} \
425
450
${TARGET_DIR} /repos/* ${UPLOAD_HOST} :${UPLOAD_SUFFIX}${TARGET_DEB_STABLE}
426
451
else
427
- rsync -e " ssh -i ${SSH_KEY_DEB_UNSTABLE} " ${RSYNC_ARGS} \
452
+ retry_rsync -e " ssh -i ${SSH_KEY_DEB_UNSTABLE} " ${RSYNC_ARGS} \
428
453
${TARGET_DIR} /repos/* ${UPLOAD_HOST} :${UPLOAD_SUFFIX}${TARGET_DEB_UNSTABLE}
429
454
fi
430
455
fi
431
456
432
457
if [ $RPM -ne 0 ] ; then
433
458
for d in $DISTRIBS_RPM ; do
434
459
if [ -n " ${STABLE} " ] ; then
435
- rsync -e " ssh -i ${SSH_KEY_RPM_STABLE} " ${RSYNC_ARGS} \
460
+ retry_rsync -e " ssh -i ${SSH_KEY_RPM_STABLE} " ${RSYNC_ARGS} \
436
461
${TARGET_DIR} /rpm/$d /* ${UPLOAD_HOST} :${UPLOAD_SUFFIX}${TARGET_RPM_STABLE} /$d /
437
462
else
438
- rsync -e " ssh -i ${SSH_KEY_RPM_UNSTABLE} " ${RSYNC_ARGS} \
463
+ retry_rsync -e " ssh -i ${SSH_KEY_RPM_UNSTABLE} " ${RSYNC_ARGS} \
439
464
${TARGET_DIR} /rpm/$d /* ${UPLOAD_HOST} :${UPLOAD_SUFFIX}${TARGET_RPM_UNSTABLE} /$d /
440
465
fi
441
466
done
0 commit comments