Skip to content

Commit

Permalink
.github: add external link check (#694)
Browse files Browse the repository at this point in the history
* .github: add external link check

* align pingcap/docs-dm#370

* update regex to exclude links

* fix dead external links

Signed-off-by: Ran <[email protected]>

Co-authored-by: Ran <[email protected]>
  • Loading branch information
yikeke and ran-huang authored Nov 2, 2020
1 parent 632a213 commit 28e6883
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
with:
config: './.markdownlint.yaml'
args: '.'
- name: Verify links
- name: Verify internal links
run: ./hack/verify-links.sh
- name: Verify link anchors
- name: Verify internal link anchors
run: ./hack/verify-link-anchors.sh
- name: "Check unclosed tags"
run:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/link-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: external-link-check

on: [pull_request]

jobs:
base:
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v2

# NOTE:
# - the check process can be very fast,
# but if `-c` is too large then `Too Many Requests (HTTP error 429)` may be reported from `https://github.com/*`.
# - we hardcode `--document-root` to `/github/workspace` in the container now.
# - we use `http://172.*` as sample addresses in some docs, so we need to exclude them.
- name: Check external links in zh files
id: lczh
uses: peter-evans/link-checker@v1
with:
args: -c 32 -d /github/workspace -r -x "http://172.*|https://github.com/.*/pull/.*|https://github.com/.*/issues/.*|https://github.com/[^.\n]*$|http://127.0.0.1.*|http://localhost.*|.*.md" zh*

- name: Check external links in en files
id: lcen
uses: peter-evans/link-checker@v1
with:
args: -c 32 -d /github/workspace -r -x "http://172.*|https://github.com/.*/pull/.*|https://github.com/.*/issues/.*|https://github.com/[^.\n]*$|http://127.0.0.1.*|http://localhost.*|.*.md" en*

- name: Fail if there were external link errors
if: ${{ steps.lczh.outputs.exit_code || steps.lcen.outputs.exit_code }}
run: |
echo "Please check the broken links reported in previous steps \"Check external links in zh files\" and \"Check external links in en files\"."
exit ${{ steps.lczh.outputs.exit_code || steps.lcen.outputs.exit_code }}
# Debug via SSH if previous steps failed
#- name: Set up tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v2
2 changes: 1 addition & 1 deletion en/configure-a-tidb-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ spec:
logLevel: info
```

For all configurable start parameters of TiCDC, see [TiCDC start parameters](https://pingcap.com/docs/stable/ticdc/deploy-ticdc/#manually-add-ticdc-component-to-an-existing-tidb-cluster).
For all configurable start parameters of TiCDC, see [TiCDC configuration](https://github.com/pingcap/tidb-operator/blob/master/docs/api-references/docs.md#ticdcconfig).

## Configure high availability

Expand Down
2 changes: 1 addition & 1 deletion en/enable-admission-webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Kubernetes v1.9 introduces the [dynamic admission control](https://kubernetes.io

Unlike those of most products on Kubernetes, the admission controller of TiDB Operator consists of two mechanisms: [extension API-server](https://kubernetes.io/docs/tasks/access-kubernetes-api/setup-extension-api-server/) and [Webhook Configuration](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#configure-admission-webhooks-on-the-fly).

To use the admission controller, you need to enable the aggregation layer feature of the Kubernetes cluster. The feature is enabled by default. To check whether it is enabled, see [Enable Kubernetes Apiserver flags](https://kubernetes.io/docs/tasks/access-kubernetes-api/configure-aggregation-layer/#enable-kubernetes-apiserver-flags).
To use the admission controller, you need to enable the aggregation layer feature of the Kubernetes cluster. The feature is enabled by default. To check whether it is enabled, see [Enable Kubernetes Apiserver flags](https://kubernetes.io/docs/tasks/extend-kubernetes/configure-aggregation-layer/#enable-kubernetes-apiserver-flags).

## Enable the admission controller

Expand Down
2 changes: 1 addition & 1 deletion zh/configure-a-tidb-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ spec:
logLevel: info
```

获取所有可以配置的 TiCDC 启动参数,请参考 [TiCDC 启动参数文档](https://pingcap.com/docs-cn/stable/ticdc/deploy-ticdc/#手动在原有-tidb-集群上新增-ticdc-组件)。
获取所有可以配置的 TiCDC 启动参数,请参考 [TiCDC 启动参数文档](https://github.com/pingcap/tidb-operator/blob/master/docs/api-references/docs.md#ticdcconfig)。

## 高可用配置

Expand Down
8 changes: 4 additions & 4 deletions zh/enable-admission-webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Kubernetes 在 1.9 版本引入了 [动态准入机制](https://kubernetes.io/zh

## 先置条件

TiDB Operator 准入控制器与大部分 Kubernetes 平台上产品的准入控制器较为不同,TiDB Operator 通过[扩展 API-Server](https://kubernetes.io/docs/tasks/access-kubernetes-api/setup-extension-api-server/)[WebhookConfiguration](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#configure-admission-webhooks-on-the-fly) 的两个机制组合而成。所以需要 Kubernetes 集群启用聚合层功能,通常情况下这个功能已经默认开启。如需查看是否开启聚合层功能,请参考[启用 Kubernetes Apiserver 标志](https://kubernetes.io/zh/docs/tasks/access-kubernetes-api/configure-aggregation-layer/#%E5%90%AF%E7%94%A8-kubernetes-apiserver-%E6%A0%87%E5%BF%97)
TiDB Operator 准入控制器与大部分 Kubernetes 平台上产品的准入控制器较为不同,TiDB Operator 通过[扩展 API-Server](https://kubernetes.io/docs/tasks/access-kubernetes-api/setup-extension-api-server/)[WebhookConfiguration](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#configure-admission-webhooks-on-the-fly) 的两个机制组合而成。所以需要 Kubernetes 集群启用聚合层功能,通常情况下这个功能已经默认开启。如需查看是否开启聚合层功能,请参考[启用 Kubernetes Apiserver 标志](https://kubernetes.io/zh/docs/tasks/extend-kubernetes/configure-aggregation-layer/#启用-kubernetes-apiserver-标志)

## 开启 TiDB Operator 准入控制器

Expand Down Expand Up @@ -169,7 +169,7 @@ TiDB Operator 在默认安装情况下不会开启准入控制器,你需要手
4. 修改 values.yaml 并安装或升级 TiDB Operator

获取 `ca.crt` 的值:

{{< copyable "shell-regular" >}}

```shell
Expand Down Expand Up @@ -217,7 +217,7 @@ TiDB Operator 通过准入控制器的帮助实现了许多功能。我们将在
{{< copyable "shell-regular" >}}

```shell
$ kubectl annotate tidbcluster ${name} -n ${namespace} tidb.pingcap.com/tikv-partition=2
$ kubectl annotate tidbcluster ${name} -n ${namespace} tidb.pingcap.com/tikv-partition=2
tidbcluster.pingcap.com/${name} annotated
```

Expand All @@ -226,7 +226,7 @@ TiDB Operator 通过准入控制器的帮助实现了许多功能。我们将在
{{< copyable "shell-regular" >}}

```shell
$ kubectl annotate tidbcluster ${name} -n ${namespace} tidb.pingcap.com/tikv-partition-
$ kubectl annotate tidbcluster ${name} -n ${namespace} tidb.pingcap.com/tikv-partition-
tidbcluster.pingcap.com/${name} annotated
```

Expand Down

0 comments on commit 28e6883

Please sign in to comment.