From c4ab7bcfd0760314042808b74b672d8cfb3b0487 Mon Sep 17 00:00:00 2001 From: Yaksh Bariya Date: Thu, 14 Apr 2022 17:26:22 +0530 Subject: [PATCH] attempt2: Fix repository upload problems Earlier in 5b8b15e7aa13569b67ba8155f0e994c23263a193, 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) --- .github/workflows/packages.yml | 9 +++------ scripts/aptly_api.sh | 4 +--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 1da524fde..d7b57f68e 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -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 diff --git a/scripts/aptly_api.sh b/scripts/aptly_api.sh index 7cacbdc9f..df90b1674 100644 --- a/scripts/aptly_api.sh +++ b/scripts/aptly_api.sh @@ -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() {