github actions: filter http codes when publishing changes, handle 504
Aptly may process request for long time enough to make CloudFlare or server drop connection. Treat this as false failure and don't stop GitHub Actions with error status.
This commit is contained in:
parent
c37c34b468
commit
7aa03f39d8
9
.github/workflows/packages.yml
vendored
9
.github/workflows/packages.yml
vendored
@ -287,14 +287,19 @@ jobs:
|
||||
--write-out '|%{http_code}' \
|
||||
https://packages-cf.termux.org/aptly-api/publish/${REPOSITORY_NAME}/${REPOSITORY_DISTRIBUTION} || true
|
||||
)
|
||||
http_status_code=$(echo "$curl_response" | cut -d'|' -f2)
|
||||
http_status_code=$(echo "$curl_response" | cut -d'|' -f2 | grep -oP '\d{3}$')
|
||||
|
||||
if [ "$http_status_code" = "200" ]; then
|
||||
echo "[$(date +%H:%M:%S)] Repository has been updated successfully."
|
||||
elif [ "$http_status_code" = "000" ]; then
|
||||
echo "[$(date +%H:%M:%S)] Error: server/proxy has dropped connection."
|
||||
echo "[$(date +%H:%M:%S)] Warning: server/proxy has dropped connection."
|
||||
# Ignore - nothing can be done with that unless we change proxy.
|
||||
#exit 1
|
||||
elif [ "$http_status_code" = "504" ]; then
|
||||
echo "[$(date +%H:%M:%S)] Warning: request processing time was too long, connection dropped."
|
||||
# Ignore - nothing can be done with that unless we change repository
|
||||
# management tool or reduce repository size.
|
||||
#exit 1
|
||||
else
|
||||
echo "[$(date +%H:%M:%S)] Error: got http_status_code == '$http_status_code'"
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user