Skip to content

Commit d6052b6

Browse files
authored
Update lint script for archive sites (#16537)
1 parent 606099a commit d6052b6

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

scripts/lint_site.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
set -e
1818

1919
FAILED=0
20+
ARCHIVE=0
21+
22+
# If the archive flag is set, we allow links to `/latest/` that won't exist
23+
# at the time of linting, but will exist when the archive is copied to the
24+
# current serving branch.
25+
if grep -q "^archive: true" data/args.yml 2>/dev/null; then
26+
ARCHIVE=1
27+
fi
2028

2129
if [[ "$#" -ne 0 ]]; then
2230
LANGS="$*"
@@ -204,13 +212,16 @@ if [ -d ./public ]; then
204212
printf -v ignore_files "/^.\/public\/%s/," "${SKIP_LANGS[@]}"; ignore_files="${ignore_files%,}"
205213
fi
206214
echo "Running linkinator..."
207-
if [[ ${CHECK_EXTERNAL_LINKS:-} == "true" ]]; then
215+
if [[ ${ARCHIVE:-} -eq 1 ]]; then
216+
if ! linkinator public/ -r -s 'github.com localhost:3000 localhost:5601 localhost:8001 localhost:9080 localhost:9081 en.wikipedia.org my-istio-logs-database.io ^((?!localhost).)*$ /latest/' --silent --concurrency 25; then
217+
FAILED=1
218+
fi
219+
elif [[ ${CHECK_EXTERNAL_LINKS:-} == "true" ]]; then
208220
if ! linkinator public/ -r -s 'github.com localhost:3000 localhost:5601 localhost:8001 localhost:9080 localhost:9081 en.wikipedia.org my-istio-logs-database.io' --silent --concurrency 25; then
209221
FAILED=1
210222
fi
211223
else
212-
#TODO: Remove .../workload-selector/ from ignored links. PRs take a long time to get through istio/api, and a link is broken from there. Once this PR is complete, remove it: https://github.com/istio/api/pull/1405
213-
if ! linkinator public/ -r -s 'github.com localhost:3000 localhost:5601 localhost:8001 localhost:9080 localhost:9081 en.wikipedia.org my-istio-logs-database.io ^((?!localhost).)*$ /docs/reference/config/type/v1beta1/workload-selector/' --silent --concurrency 25; then
224+
if ! linkinator public/ -r -s 'github.com localhost:3000 localhost:5601 localhost:8001 localhost:9080 localhost:9081 en.wikipedia.org my-istio-logs-database.io ^((?!localhost).)*$' --silent --concurrency 25; then
214225
FAILED=1
215226
fi
216227
fi

0 commit comments

Comments
 (0)