Merge pull request #10331 from keymanapp/chore/linux/improvegha

chore(linux): Retry llso upload
This commit is contained in:
Eberhard Beilharz 2024-01-09 11:47:22 +01:00 committed by GitHub
commit ad27bdf782
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -205,6 +205,34 @@ jobs:
- name: Upload
run: |
function dput_retry() {
local i=1
local retval
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 ${tmpfile}
retval=$?
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
return
fi
fi
if ((++i <= max_retries)); then
sleep 10
echo "Retry ${i}/${max_retries}:"
fi
done
rm ${tmpfile}
exit ${retval}
}
case ${{ github.event.client_payload.branch }} in
stable-*) destination='' ;;
beta) destination='-proposed' ;;
@ -214,7 +242,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 +251,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::"