attempt2: Fix repository upload problems

Earlier in 5b8b15e7aa, I had configured
our upload scripts to treat failure of `aptly_add_to_repo` as failure to publish
packages at all. However it won't work, since even if all debs are
uploaded, and aptly_add_to_repo is called, debs are moved from temporary
directory to the repository. The proxy may drop connection during this
moment due to stale connection. And just after that we call
aptly_delete_dir which will delete the temporary directory. On the
server side, aptly will however continue to move debs from temporary
directory. Repository is published, but since the temporary directory is
removed during the transaction, the transaction never completely
succeeds. So only some of the debs are uploaded practically. This is now
fixed by adding a sleep of 180s (should be more than enough for all
stuff)
This commit is contained in:
Yaksh Bariya 2022-04-14 17:26:22 +05:30
parent d43f9ea9af
commit c4ab7bcfd0
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
2 changed files with 4 additions and 9 deletions

View File

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

View File

@ -77,10 +77,8 @@ aptly_add_to_repo() {
echo
fi
else
echo "[$(date +%H:%M:%S)] Error: got http_status_code == '$http_status_code', packages may not appear in repository."
return 1
echo "[$(date +%H:%M:%S)] Warning: got http_status_code == '$http_status_code', packages may not appear in repository."
fi
return 0
}
aptly_publish_repo() {