1
0
Fork 0
mirror of https://github.com/benbusby/farside.git synced 2025-04-25 13:10:02 +00:00

Handle dig return code 9 in update workflow

If dig returns exit code 9 (no reply from server) when checking an
instance for cloudflare records, it shouldn't fail the CI build but
rather just skip adding the instance to the non-cloudflare services
list.

This should be re-evaluated soon to see if the CI build routinely has
issues with getting a server reply. If so, a different approach needs to
be taken to check if an instance is using cloudflare.
This commit is contained in:
Ben Busby 2022-07-31 11:47:28 -06:00
parent 431ea613d1
commit 3460986481
No known key found for this signature in database
GPG key ID: B9B7231E01D924A1
2 changed files with 15 additions and 12 deletions

View file

@ -32,17 +32,19 @@ jobs:
file="services-full.json"
while read -r line; do
if [[ "$line" == "\"https://"* ]]; then
domain=$(echo "$line" | sed -e "s/^\"https:\/\///" -e "s/\",//" -e "s/\"//")
ns=$(dig ns "$domain")
if [[ "$ns" == *"cloudflare"* ]]; then
echo "\"$domain\" using cloudflare, skipping..."
else
echo "$line" >> out.json
fi
if [[ "$line" == "\"https://"* ]]; then
domain=$(echo "$line" | sed -e "s/^\"https:\/\///" -e "s/\",//" -e "s/\"//")
ns=$(dig ns "$domain" || true)
if [[ "$ns" == *"cloudflare"* ]]; then
echo "\"$domain\" using cloudflare, skipping..."
elif [ ${#ns} -eq 0 ]; then
echo "Unable to verify records for \"$domain\", skipping..."
else
echo "$line" >> out.json
echo "$line" >> out.json
fi
else
echo "$line" >> out.json
fi
done <$file
# Remove any trailing commas from new instance lists