Skip to content

Commit b1f54ac

Browse files
authored
Add link checker to fix broken links in markdown (#140)
1 parent bba6fab commit b1f54ac

File tree

5 files changed

+82
-5
lines changed

5 files changed

+82
-5
lines changed

.lycheeignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
https?://example\.com(/.*)?
2+
https?://localhost(:.*)?(\/.*)?
3+
https?://127\.0\.0\.1(:.*)?(\/.*)?

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ If you're interested in participating in future discussions or development relat
7979
- **Slack**: [#sig-node-readiness-controller](https://kubernetes.slack.com/messages/sig-node-readiness-controller). (visit [slack.k8s.io](https://slack.k8s.io) for a workspace invitation)
8080
8181
Open Issues / PRs / Discussions here:
82-
- **Issues**: [GitHub Issues](https://sigs.k8s.io/node-readiness-controller/issues)
83-
- **Discussions**: [GitHub Discussions](https://sigs.k8s.io/node-readiness-controller/discussions)
82+
- **Issues**: [GitHub Issues](https://github.com/kubernetes-sigs/node-readiness-controller/issues)
83+
- **Discussions**: [GitHub Discussions](https://github.com/kubernetes-sigs/node-readiness-controller/discussions)
8484
8585
See the Kubernetes community on the [community page](http://kubernetes.io/community/). You can also engage with SIG Node at [#sig-node](https://kubernetes.slack.com/messages/sig-node) and [mailing List](https://groups.google.com/a/kubernetes.io/g/sig-node)
8686

docs/book/src/introduction.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Node Readiness Controller
22

3-
<img style="float: right; margin: auto;" width="180px" src="/logo/node-readiness-controller-logo.svg"/>
3+
<img style="float: right; margin: auto;" width="180px" src="logo/node-readiness-controller-logo.svg"/>
44

55
A Kubernetes controller that provides fine-grained, declarative readiness for nodes. It ensures nodes only accept workloads when all required components (e.g., network agents, GPU drivers, storage drivers, or custom health-checks) are fully ready on the node.
66

@@ -65,8 +65,8 @@ If you're interested in participating in future discussions or development relat
6565
- **Slack**: [#sig-node-readiness-controller](https://kubernetes.slack.com/messages/sig-node-readiness-controller) (visit [slack.k8s.io](https://slack.k8s.io) for a workspace invitation)
6666
6767
Open Issues / PRs / Discussions here:
68-
- **Issues**: [GitHub Issues](https://sigs.k8s.io/node-readiness-controller/issues)
69-
- **Discussions**: [GitHub Discussions](https://sigs.k8s.io/node-readiness-controller/discussions)
68+
- **Issues**: [GitHub Issues](https://github.com/kubernetes-sigs/node-readiness-controller/issues)
69+
- **Discussions**: [GitHub Discussions](https://github.com/kubernetes-sigs/node-readiness-controller/discussions)
7070
7171
See the Kubernetes community on the [community page](http://kubernetes.io/community/). You can also engage with SIG Node at [#sig-node](https://kubernetes.slack.com/messages/sig-node) and [mailing list](https://groups.google.com/a/kubernetes.io/g/sig-node).
7272

hack/verify-all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ set -o pipefail
2020

2121
# Run all verification scripts
2222
hack/verify-boilerplate.sh
23+
hack/verify-links.sh

hack/verify-links.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# This script checks for broken links for all markdown files.
18+
# Usage: `hack/verify-links.sh`.
19+
20+
set -o errexit
21+
set -o nounset
22+
set -o pipefail
23+
24+
# Get the root directory
25+
ROOT_DIR=$(dirname "${BASH_SOURCE[0]}")/..
26+
27+
cd "$ROOT_DIR"
28+
29+
# Create temp directory to download lychee binary
30+
TEMP_DIR=$(mktemp -d)
31+
trap 'rm -rf "${TEMP_DIR}"' EXIT
32+
33+
# Detect OS and architecture
34+
os=$(go env GOOS)
35+
arch=$(go env GOARCH)
36+
37+
# Map to lychee release asset names
38+
LYCHEE_VERSION="${LYCHEE_VERSION:-0.23.0}"
39+
LYCHEE_BINARY="lychee"
40+
EXT="tar.gz"
41+
EXTRACT_CMD="tar -C ${TEMP_DIR} -xzf"
42+
case "${os}-${arch}" in
43+
linux-amd64)
44+
LYCHEE_BASENAME="${LYCHEE_BINARY}-x86_64-unknown-linux-gnu"
45+
;;
46+
linux-arm64)
47+
LYCHEE_BASENAME="${LYCHEE_BINARY}-aarch64-unknown-linux-gnu"
48+
;;
49+
darwin-arm64)
50+
LYCHEE_BASENAME="${LYCHEE_BINARY}-arm64-macos"
51+
;;
52+
*)
53+
echo "Unsupported platform: ${os}-${arch}" >&2
54+
exit 1
55+
;;
56+
esac
57+
58+
LYCHEE_URL="https://github.com/lycheeverse/lychee/releases/download/lychee-v${LYCHEE_VERSION}/${LYCHEE_BASENAME}.${EXT}"
59+
60+
echo "downloading ${LYCHEE_BASENAME}.${EXT} from ${LYCHEE_URL}"
61+
if ! curl -fL -o ${TEMP_DIR}/${LYCHEE_BINARY}.${EXT} "${LYCHEE_URL}"; then
62+
echo "Failed to downlowd lychee from ${LYCHEE_URL}" >&2
63+
exit 1
64+
fi
65+
66+
if ! ${EXTRACT_CMD} "${TEMP_DIR}/${LYCHEE_BINARY}.${EXT}"; then
67+
echo "Failed to extract lychee binary from ${TEMP_DIR}/${LYCHEE_BINARY}.${EXT}" >&2
68+
exit 1
69+
fi
70+
chmod +x ${TEMP_DIR}/${LYCHEE_BINARY}
71+
72+
echo "Checking links in Markdown files..."
73+
"${TEMP_DIR}/${LYCHEE_BINARY}" --no-progress --timeout 30 --format detailed '**/*.md'

0 commit comments

Comments
 (0)