From 4aecb28ac441210e6e38768b6b5585a67a12d89d Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Mon, 8 Jan 2024 15:13:28 +0100 Subject: [PATCH 1/2] chore(linux): Retry llso upload Occasionally name resolution temporarily fails when trying to upload to llso. This change retries 10 times before giving up. --- .github/workflows/deb-packaging.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deb-packaging.yml b/.github/workflows/deb-packaging.yml index fad8121910..5ac17294c9 100644 --- a/.github/workflows/deb-packaging.yml +++ b/.github/workflows/deb-packaging.yml @@ -205,6 +205,31 @@ jobs: - name: Upload run: | + function dput_retry() { + local i=1 + local retval + local upload_log=$1 + local hosttarget=$2 + local max_retries=10 + shift 2 + while ((i <= max_retries)); do + dput ${upload_log} ${hosttarget} "$@" 2>&1 | tee /tmp/dput.output + retval=$? + if ! grep -q "ssh: Could not resolve hostname package-drop.psonet: Name or service not known" /tmp/dput.output; then + if ((retval != 0)); then + exit ${retval} + else + return + fi + fi + if ((++i <= max_retries)); then + sleep 10 + echo "Retry ${i}/${max_retries}:" + fi + done + exit ${retval} + } + case ${{ github.event.client_payload.branch }} in stable-*) destination='' ;; beta) destination='-proposed' ;; @@ -214,7 +239,7 @@ jobs: echo -e "::group::${COLOR_GREEN}Upload source package" cd keyman-srcpkg - dput -U llso:ubuntu/jammy${destination} *_source.changes + dput_retry -U llso:ubuntu/jammy${destination} *_source.changes echo "::endgroup::" echo -e "::group::${COLOR_GREEN}Uploading binary packages" @@ -223,7 +248,7 @@ jobs: for f in *.changes; do if [[ $f =~ $pattern ]]; then dist=${BASH_REMATCH[1]} - dput -U llso:ubuntu/${dist}${destination} $f + dput_retry -U llso:ubuntu/${dist}${destination} $f fi done echo "::endgroup::" From 9c8566658eb7de67b68df7134acc0826bf09312f Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Tue, 9 Jan 2024 08:47:03 +0100 Subject: [PATCH 2/2] chore(linux): Cleanup tmpfile --- .github/workflows/deb-packaging.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deb-packaging.yml b/.github/workflows/deb-packaging.yml index 5ac17294c9..79f09f1eaf 100644 --- a/.github/workflows/deb-packaging.yml +++ b/.github/workflows/deb-packaging.yml @@ -211,11 +211,13 @@ jobs: local upload_log=$1 local hosttarget=$2 local max_retries=10 + local tmpfile=/tmp/dput.output shift 2 while ((i <= max_retries)); do - dput ${upload_log} ${hosttarget} "$@" 2>&1 | tee /tmp/dput.output + dput ${upload_log} ${hosttarget} "$@" 2>&1 | tee ${tmpfile} retval=$? - if ! grep -q "ssh: Could not resolve hostname package-drop.psonet: Name or service not known" /tmp/dput.output; then + if ! grep -q "ssh: Could not resolve hostname package-drop.psonet: Name or service not known" ${tmpfile}; then + rm ${tmpfile} if ((retval != 0)); then exit ${retval} else @@ -227,6 +229,7 @@ jobs: echo "Retry ${i}/${max_retries}:" fi done + rm ${tmpfile} exit ${retval} }