Skip to content

Commit d9380ea

Browse files
authored
Add a target to find dead link in our documentation. (grafana#3713)
This is not part of the CI because it can be throttle and it's not super fast ~2min. But still usefull to check that no link are down if we make some big structure changes. Signed-off-by: Cyril Tovena <[email protected]>
1 parent ae5548c commit d9380ea

File tree

7 files changed

+129
-9
lines changed

7 files changed

+129
-9
lines changed

.drone/drone.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ workspace:
1212

1313
steps:
1414
- name: test
15-
image: grafana/loki-build-image:0.13.0
15+
image: grafana/loki-build-image:0.14.0
1616
commands:
1717
- make BUILD_IN_CONTAINER=false test
1818
depends_on:
1919
- clone
2020

2121
- name: lint
22-
image: grafana/loki-build-image:0.13.0
22+
image: grafana/loki-build-image:0.14.0
2323
commands:
2424
- make BUILD_IN_CONTAINER=false lint
2525
depends_on:
2626
- clone
2727

2828
- name: check-generated-files
29-
image: grafana/loki-build-image:0.13.0
29+
image: grafana/loki-build-image:0.14.0
3030
commands:
3131
- make BUILD_IN_CONTAINER=false check-generated-files
3232
depends_on:
3333
- clone
3434

3535
- name: check-mod
36-
image: grafana/loki-build-image:0.13.0
36+
image: grafana/loki-build-image:0.14.0
3737
commands:
3838
- make BUILD_IN_CONTAINER=false check-mod
3939
depends_on:

.lychee.toml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
###
2+
### Display
3+
###
4+
# Verbose program output
5+
verbose = false
6+
7+
# Show progress
8+
progress = false
9+
10+
11+
###
12+
### Runtime
13+
###
14+
# Number of threads to utilize.
15+
# Defaults to number of cores available to the system if omitted.
16+
#threads = 2
17+
18+
# Maximum number of allowed redirects
19+
max_redirects = 10
20+
21+
22+
###
23+
### Requests
24+
###
25+
# User agent to send with each request
26+
user_agent = "curl/7.71.1"
27+
28+
# Website timeout from connect to response finished
29+
timeout = 9
30+
31+
# Comma-separated list of accepted status codes for valid links.
32+
# Omit to accept all response types.
33+
#accept = "text/html"
34+
35+
# Proceed for server connections considered insecure (invalid TLS)
36+
insecure = true
37+
38+
# Only test links with the given scheme (e.g. https)
39+
# Omit to check links with any scheme
40+
#scheme = "https"
41+
42+
# Request method
43+
method = "get"
44+
45+
# Custom request headers
46+
headers = []
47+
48+
49+
###
50+
### Exclusions
51+
###
52+
# Exclude URLs from checking (supports regex)
53+
exclude = [
54+
# "github", todo github token
55+
"file://.*",
56+
"host.docker.internal:3100",
57+
"fileb://.*",
58+
"ec2-user@.*.compute.amazonaws.com",
59+
"querier",
60+
"loki:3100",
61+
"ip_or_hostname_where_loki_run:3100",
62+
"dynamodb://.*",
63+
"s3://.*",
64+
"ec2-13-59-62-37",
65+
"promtail.default",
66+
"loki_addr:3100",
67+
"localhost",
68+
"example.com",
69+
"HelloAkkaHttpServer",
70+
"https://loki/",
71+
"http://loki/",
72+
"logs-prod-us-central1.grafana.net",
73+
"ip_or_hostname_where_loki_runs",
74+
"inmemory://",
75+
"myloki.domain:3100",
76+
"grafana/[email protected]",
77+
"loki.git",
78+
"https://github.com/grafana/website",
79+
"https://github.com/settings/keys",
80+
]
81+
82+
include = []
83+
84+
# Exclude all private IPs from checking
85+
# Equivalent to setting `exclude_private`, `exclude_link_local`, and `exclude_loopback` to true
86+
exclude_all_private = false
87+
88+
# Exclude private IP address ranges from checking
89+
exclude_private = false
90+
91+
# Exclude link-local IP address range from checking
92+
exclude_link_local = false
93+
94+
# Exclude loopback IP address range from checking
95+
exclude_loopback = true
96+
97+
# Exclude all mail addresses from checking
98+
exclude_mail = false

Makefile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
.PHONY: push-images push-latest save-images load-images promtail-image loki-image build-image
77
.PHONY: bigtable-backup, push-bigtable-backup
88
.PHONY: benchmark-store, drone, check-mod
9-
.PHONY: migrate migrate-image
9+
.PHONY: migrate migrate-image lint-markdown
1010

1111
SHELL = /usr/bin/env bash
1212

@@ -38,7 +38,7 @@ DOCKER_IMAGE_DIRS := $(patsubst %/Dockerfile,%,$(DOCKERFILES))
3838
# make BUILD_IN_CONTAINER=false target
3939
# or you can override this with an environment variable
4040
BUILD_IN_CONTAINER ?= true
41-
BUILD_IMAGE_VERSION := 0.13.0
41+
BUILD_IMAGE_VERSION := 0.14.0
4242

4343
# Docker image info
4444
IMAGE_PREFIX ?= grafana
@@ -576,6 +576,19 @@ fmt-jsonnet:
576576
@find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
577577
xargs -n 1 -- jsonnetfmt -i
578578

579+
# search for dead link in our documentation.
580+
# To avoid being rate limited by Github you can use an env variable GITHUB_TOKEN to pass a github token API.
581+
# see https://github.com/settings/tokens
582+
lint-markdown:
583+
ifeq ($(BUILD_IN_CONTAINER),true)
584+
$(SUDO) docker run $(RM) $(TTY) -i \
585+
-v $(shell pwd):/src/loki$(MOUNT_FLAGS) \
586+
$(IMAGE_PREFIX)/loki-build-image:$(BUILD_IMAGE_VERSION) $@;
587+
else
588+
lychee --verbose --config .lychee.toml ./*.md ./docs/**/*.md ./production/**/*.md ./cmd/**/*.md ./clients/**/*.md ./tools/**/*.md
589+
endif
590+
591+
579592
# usage: FUZZ_TESTCASE_PATH=/tmp/testcase make test-fuzz
580593
# this will run the fuzzing using /tmp/testcase and save benchmark locally.
581594
test-fuzz:

docs/sources/architecture/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Since all distributors share access to the same hash ring, write requests can be
103103
sent to any distributor.
104104

105105
To ensure consistent query results, Loki uses
106-
[Dynamo-style](https://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf)
106+
[Dynamo-style](https://www.cs.princeton.edu/courses/archive/fall15/cos518/studpres/dynamo.pdf)
107107
quorum consistency on reads and writes. This means that the distributor will wait
108108
for a positive response of at least one half plus one of the ingesters to send
109109
the sample to before responding to the client that initiated the send.

docs/sources/clients/promtail/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ positions:
12811281
filename: /tmp/positions.yaml
12821282

12831283
clients:
1284-
- url: http://ip_or_hostname_where_loki_runns:3100/loki/api/v1/push
1284+
- url: http://ip_or_hostname_where_loki_runs:3100/loki/api/v1/push
12851285

12861286
scrape_configs:
12871287
- job_name: journal

docs/sources/overview/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Since all distributors share access to the same hash ring, write requests can be
6262
sent to any distributor.
6363

6464
To ensure consistent query results, Loki uses
65-
[Dynamo-style](https://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf)
65+
[Dynamo-style](https://www.cs.princeton.edu/courses/archive/fall15/cos518/studpres/dynamo.pdf)
6666
quorum consistency on reads and writes. This means that the distributor will wait
6767
for a positive response of at least one half plus one of the ingesters to send
6868
the sample to before responding to the user.

loki-build-image/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ RUN apk add --no-cache curl && \
77
mv /tmp/linux-amd64/helm /usr/bin/helm && \
88
rm -rf /tmp/linux-amd64 /tmp/helm-$HELM_VER.tgz
99

10+
FROM alpine as lychee
11+
ARG LYCHEE_VER="0.7.0"
12+
RUN apk add --no-cache curl && \
13+
curl -L -o /tmp/lychee-$LYCHEE_VER.tgz https://github.com/lycheeverse/lychee/releases/download/${LYCHEE_VER}/lychee-${LYCHEE_VER}-x86_64-unknown-linux-gnu.tar.gz && \
14+
tar -xz -C /tmp -f /tmp/lychee-$LYCHEE_VER.tgz && \
15+
mv /tmp/lychee /usr/bin/lychee && \
16+
rm -rf /tmp/linux-amd64 /tmp/lychee-$LYCHEE_VER.tgz
17+
1018
FROM alpine as golangci
1119
RUN apk add --no-cache curl && \
1220
cd / && \
@@ -40,6 +48,7 @@ RUN apt-get update && \
4048

4149
COPY --from=docker /usr/bin/docker /usr/bin/docker
4250
COPY --from=helm /usr/bin/helm /usr/bin/helm
51+
COPY --from=lychee /usr/bin/lychee /usr/bin/lychee
4352
COPY --from=golangci /bin/golangci-lint /usr/local/bin
4453
COPY --from=drone /go/bin/drone /usr/bin/drone
4554
COPY --from=faillint /go/bin/faillint /usr/bin/faillint

0 commit comments

Comments
 (0)