Skip to content

Commit 091bebf

Browse files
committed
Make the nightly link check trustworthy: stop failing on no-response, fix the one real dead link
1 parent 730b77a commit 091bebf

2 files changed

Lines changed: 8 additions & 27 deletions

File tree

.ci/docker/common/install_openssl.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
# This source code is licensed under the BSD-style license found in the
66
# LICENSE file in the root directory of this source tree.
77

8-
# NB: This script is needed for sccache and is adopted from PyTorch core repo at
9-
# https://github.com/pytorch/pytorch/blob/main/.ci/docker/common/install_openssl.sh
8+
# NB: This script is needed for sccache and is adopted from PyTorch core repo.
9+
# Core deleted its copy in pytorch/pytorch#179513, so this points at the last
10+
# revision that still had it instead of at a branch.
11+
# https://github.com/pytorch/pytorch/blob/9274b93eac9f026e9f51e282449b0300b8e05482/.ci/docker/common/install_openssl.sh
1012
set -ex
1113

1214
OPENSSL=openssl-1.1.1k

scripts/lint_urls.sh

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,10 @@ while IFS=: read -r filepath url; do
2626
sleep 1
2727
code=$(curl -k -gsLm30 --retry 3 --retry-delay 3 --retry-connrefused -o /dev/null -w "%{http_code}" -r 0-0 -A "$user_agent" "$url") || code=000
2828
fi
29-
if [ "$code" -lt 200 ] || [ "$code" -ge 400 ]; then
30-
sleep 1
31-
request_id=$(curl -sS -G -H 'Accept: application/json' \
32-
--data-urlencode "host=$url" \
33-
--data-urlencode "max_nodes=1" \
34-
--data-urlencode "node=us3.node.check-host.net" \
35-
https://check-host.net/check-http \
36-
| jq -r .request_id) || request_id=""
37-
if [ -n "$request_id" ]; then
38-
sleep 5
39-
for _ in {1..5}; do
40-
new_code=$(curl -sS -H 'Accept: application/json' \
41-
"https://check-host.net/check-result/$request_id" \
42-
| jq -r -e '.[][0][3]') || new_code=000
43-
[[ "$new_code" =~ ^[0-9]+$ ]] || new_code=000
44-
if [ "$new_code" -ge 200 ] && [ "$new_code" -lt 400 ]; then
45-
code=$new_code
46-
break
47-
fi
48-
sleep 5
49-
done
50-
fi
51-
fi
52-
# Treat Cloudflare JS-challenge and rate-limit as success.
53-
if [[ "$code" == "403" || "$code" == "429" || "$code" == "503" ]]; then
29+
# 403/429/503 are Cloudflare challenges and rate limits. 000 means curl never
30+
# got an HTTP response at all, which on a CI runner is a DNS, TLS or egress
31+
# problem far more often than a dead link, so it must not fail the job.
32+
if [[ "$code" == "000" || "$code" == "403" || "$code" == "429" || "$code" == "503" ]]; then
5433
printf "${yellow}WARN %s${reset} ${cyan}%s${reset} %s\n" "$code" "$url" "$filepath"
5534
exit 0
5635
fi

0 commit comments

Comments
 (0)