Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
GitLab
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
需求
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
测试用例
产物
部署
发布
Package registry
Container registry
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
洞察
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
gitlab-cn
GitLab
提交
0ccf98c2
未验证
提交
0ccf98c2
编辑于
9 months ago
作者:
Evan Read
提交者:
GitLab
9 months ago
浏览文件
操作
下载
补丁
差异文件
Update docs testing information for Lychee link checking
上级
1efbdeb9
No related branches found
No related tags found
无相关合并请求
变更
1
隐藏空白变更内容
行内
左右并排
显示
1 个更改的文件
doc/development/documentation/testing/index.md
+33
-36
33 个添加, 36 个删除
doc/development/documentation/testing/index.md
有
33 个添加
和
36 个删除
doc/development/documentation/testing/index.md
+
33
−
36
浏览文件 @
0ccf98c2
...
@@ -52,35 +52,21 @@ error if any Markdown files return a Mermaid syntax error.
...
@@ -52,35 +52,21 @@ error if any Markdown files return a Mermaid syntax error.
To help debug your Mermaid charts, use the
To help debug your Mermaid charts, use the
[
Mermaid Live Editor
](
https://mermaid-js.github.io/mermaid-live-editor/edit
)
.
[
Mermaid Live Editor
](
https://mermaid-js.github.io/mermaid-live-editor/edit
)
.
## Tests in `docs-lint links`
## Tests in `docs-lint links`
and other jobs
Merge requests containing changes to Markdown (
`.md`
) files run a
`docs-lint links`
To check for broken links, merge requests containing changes to Markdown (
`.md`
) files run these jobs in their
job, which runs two types of link checks. In both cases, links with destinations
pipelines:
that begin with
`http`
or
`https`
are considered external links, and skipped:
-
`bundle exec nanoc check internal_links`
: Tests links to internal pages.
-
`docs-lint links`
job in the
`gitlab`
project. For example:
<https://gitlab.com/gitlab-org/gitlab/-/jobs/7065686331>
.
-
`bundle exec nanoc check internal_anchors`
: Tests links to topic title anchors on internal pages.
-
`docs-lint links`
job in the
`omnibus-gitlab`
project. For example:
<https://gitlab.com/gitlab-org/omnibus-gitlab/-/jobs/7065337075>
.
-
`docs-lint links`
job in the
`gitlab-operator`
project.
-
`docs:lint markdown`
job in the
`gitlab-runner`
project, which includes link checking. For example:
<https://gitlab.com/gitlab-org/gitlab-runner/-/jobs/7056674997>
.
-
`check_docs_links`
job in the
`charts/gitlab`
project. For example:
<https://gitlab.com/gitlab-org/charts/gitlab/-/jobs/7066011619>
.
Failures from these tests are displayed at the end of the test results in the
**Issues found!**
area.
These jobs check links, including anchor links, and report any problems. Any link that requires a network
For example, failures in the
`internal_anchors`
test follow this format:
connection is skipped.
```
plaintext
[ ERROR ] internal_anchors - Broken anchor detected!
- source file `/tmp/gitlab-docs/public/ee/user/application_security/api_fuzzing/index.html`
- destination `/tmp/gitlab-docs/public/ee/development/code_review.html`
- link `../../../development/code_review.html#review-response-slo`
- anchor `#review-response-slo`
```
-
**Source file**
: The full path to the file containing the error. To find the
file in the
`gitlab`
repository, replace
`/tmp/gitlab-docs/public/ee`
with
`doc`
, and
`.html`
with
`.md`
.
-
**Destination**
: The full path to the file not found by the test. To find the
file in the
`gitlab`
repository, replace
`/tmp/gitlab-docs/public/ee`
with
`doc`
, and
`.html`
with
`.md`
.
-
**Link**
: The actual link the script attempted to find.
-
**Anchor**
: If present, the topic title anchor the script attempted to find.
Check for multiple instances of the same broken link on each page reporting an error.
Even if a specific broken link appears multiple times on a page, the test reports it only once.
## Tests in `ui-docs-links lint`
## Tests in `ui-docs-links lint`
...
@@ -156,19 +142,30 @@ The output should be similar to:
...
@@ -156,19 +142,30 @@ The output should be similar to:
### Run documentation link tests locally
### Run documentation link tests locally
To
test links in the documentation locally
:
To
run documentation link tests locally, you can either
:
1.
Go to the
[
`gitlab-docs`
](
https://gitlab.com/gitlab-org/gitlab-docs
)
directory
.
-
Run a link check for a single project that contains documentation
.
1.
Run
the following commands:
-
Run
a link check across entire local copy of the
[
GitLab documentation site
](
https://docs.gitlab.com
)
.
```
shell
#### Check a single project
# Check for broken internal links
bundle
exec
nanoc check internal_links
# Check for broken external links (might take a lot of time to complete).
To check the links on a single project:
# This test is allowed to fail, and is run only in the gitlab-docs project CI
bundle
exec
nanoc check internal_anchors
1.
Install
[
Lychee
](
https://lychee.cli.rs/installation/
)
.
```
1.
Change into the root directory of the project.
1.
Run
`lychee --offline --include-fragments <doc_directory>`
where
`<doc_directory>`
it the directory that contains
documentation to check. For example:
`lychee --offline --include-fragments doc`
.
#### Check all GitLab Docs site projects
To check links on the entire
[
GitLab documentation site
](
https://docs.gitlab.com
)
:
1.
Make sure you have all the documentation projects cloned in the same directory as your
`gitlab-docs`
clone. You can
run
`make clone-all-docs-projects`
to clone any projects you don't have in that location. If you want to update
the documentation projects, run
`make update-all-projects`
.
1.
Go to the
[
`gitlab-docs`
](
https://gitlab.com/gitlab-org/gitlab-docs
)
directory.
1.
Run
`make internal-links-and-anchors-check`
, which builds the GitLab Docs site with
`nanoc`
and checks links on the
built site by using
`nanoc`
.
### Run UI link tests locally
### Run UI link tests locally
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录