ci: sleep only when aptly_add_to_repo returns with status code 000

It is just a waste of time to sleep for 3 minutes when the packages are
successfully added and aptly returns 200 http code
This commit is contained in:
Yaksh Bariya 2022-04-16 12:44:26 +05:30
parent cac3799e1d
commit dcaf44f95b
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
2 changed files with 16 additions and 4 deletions

View File

@ -218,8 +218,9 @@ jobs:
# Publishing repository changes.
if [ "$uploaded_files" = "true" ]; then
aptly_add_to_repo
sleep 180
if ! aptly_add_to_repo; then
exit 1
fi
# Usually temporary directory is deleted automatically, but in certain cases it is left.
aptly_delete_dir
@ -256,7 +257,9 @@ jobs:
# Publishing repository changes.
if [ "$uploaded_files" = "true" ]; then
aptly_add_to_repo
if ! aptly_add_to_repo; then
exit 1
fi
# Usually temporary directory is deleted automatically, but in certain cases it is left.
aptly_delete_dir

View File

@ -75,10 +75,19 @@ aptly_add_to_repo() {
echo
echo "$warnings"
echo
return 1
fi
elif [ "$http_status_code" == "000" ]; then
echo "[$(date +%H:%M:%S)] Warning: server/proxy dropped connection. Assuming that the host is adding packages inspite of lost connection."
echo "[$(date +%H:%M:%S)] Warning: Waiting for host to add packages. Sleeping for 180s. Assuming that packages will be added till then."
sleep 180
return 0
else
echo "[$(date +%H:%M:%S)] Warning: got http_status_code == '$http_status_code', packages may not appear in repository."
echo "[$(date +%H:%M:%S)] Error: got http_status_code == '$http_status_code'."
echo "[$(date +%H:%M:%S)] Error: the unexpected happened. Ask any maintainer to check the aptly log"
return 1
fi
return 0
}
aptly_publish_repo() {