From 797bf0179b99e661ffdf4fe3360cc9da028e5004 Mon Sep 17 00:00:00 2001 From: Marcel Amirault <mamirault@gitlab.com> Date: Tue, 2 Jul 2024 08:14:37 +0000 Subject: [PATCH] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: Niklas van Schrick <mc.taucher2003@gmail.com> --- .gitlab/ci/docs.gitlab-ci.yml | 2 +- doc/administration/gitaly/recovery.md | 2 +- doc/ci/docker/index.md | 2 +- doc/development/pipelines/index.md | 2 +- lefthook.yml | 5 +++++ scripts/lint-docs-link-check.sh | 20 ++++++++++++++++++++ 6 files changed, 29 insertions(+), 4 deletions(-) create mode 100755 scripts/lint-docs-link-check.sh diff --git a/.gitlab/ci/docs.gitlab-ci.yml b/.gitlab/ci/docs.gitlab-ci.yml index ffef022a9afdc..abaeb9fddcd9f 100644 --- a/.gitlab/ci/docs.gitlab-ci.yml +++ b/.gitlab/ci/docs.gitlab-ci.yml @@ -93,7 +93,7 @@ docs-lint links: stage: lint needs: [] script: - - lychee --offline --include-fragments doc + - lychee --offline --no-progress --include-fragments doc ui-docs-links lint: extends: diff --git a/doc/administration/gitaly/recovery.md b/doc/administration/gitaly/recovery.md index ec59b854a686a..225ce2c598032 100644 --- a/doc/administration/gitaly/recovery.md +++ b/doc/administration/gitaly/recovery.md @@ -246,7 +246,7 @@ random, fully up-to-date replica of the repository on another healthy Gitaly nod replication job is scheduled only if there are no other replication jobs pending for the target repository. -The reconciliation frequency can be changed via the configuration. The value can be any valid +The reconciliation frequency can be changed through the configuration. The value can be any valid [Go duration value](https://pkg.go.dev/time#ParseDuration). Values below 0 disable the feature. Examples: diff --git a/doc/ci/docker/index.md b/doc/ci/docker/index.md index ea5318dd0570e..2f64edf52851f 100644 --- a/doc/ci/docker/index.md +++ b/doc/ci/docker/index.md @@ -10,7 +10,7 @@ DETAILS: **Tier:** Free, Premium, Ultimate **Offering:** GitLab.com, Self-managed, GitLab Dedicated -There are two primary ways to incorporate [Docker](https://www.docker.com) into your CI/CD workflow: +You can incorporate [Docker](https://www.docker.com) into your CI/CD workflow in two primary ways: - **[Run your CI/CD jobs](using_docker_images.md) in Docker containers.** diff --git a/doc/development/pipelines/index.md b/doc/development/pipelines/index.md index 26f69247e1f07..723462ad28600 100644 --- a/doc/development/pipelines/index.md +++ b/doc/development/pipelines/index.md @@ -268,7 +268,7 @@ We don't have a specific number, but we need to have better numbers for flaky te ## Faster feedback for some merge requests -### Broken Master Fixes +### Broken `master` Fixes When you need to [fix a broken `master`](https://handbook.gitlab.com/handbook/engineering/workflow/#resolution-of-broken-master), you can add the `pipeline::expedited` label to expedite the pipelines that run on the merge request. diff --git a/lefthook.yml b/lefthook.yml index 407960c622359..dea02a8b0c86c 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -79,6 +79,11 @@ pre-push: files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD glob: 'data/deprecations/*.yml' run: echo "Changes to deprecation files detected. Checking deprecations..\n"; bundle exec rake gitlab:docs:check_deprecations + docs-link-check: + tags: documentation + files: git diff --name-only $(git merge-base origin/master HEAD)..HEAD + glob: 'doc/*.md' + run: scripts/lint-docs-link-check.sh db-schema-changes: tags: database files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD diff --git a/scripts/lint-docs-link-check.sh b/scripts/lint-docs-link-check.sh new file mode 100755 index 0000000000000..51c6ad985c5fc --- /dev/null +++ b/scripts/lint-docs-link-check.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -eo pipefail + +COLOR_ERROR="\e[31m" +COLOR_INFO="\e[32m" +COLOR_WARN="\e[33m" +COLOR_RESET="\e[39m" + +# shellcheck disable=2059 +if command -v lychee > /dev/null; then + printf "${COLOR_INFO}INFO: Lychee found! Checking documentation links...${COLOR_RESET}\n" + if lychee --offline --no-progress --include-fragments doc; then + printf "${COLOR_INFO}INFO: Documentation link test passed!${COLOR_RESET}\n" + else + printf "${COLOR_ERROR}ERROR: Documentation link test failed!${COLOR_RESET}\n" + exit 1 + fi +else + printf "${COLOR_WARN}WARN: Lychee not found! For more information, see <https://lychee.cli.rs/installation/>.${COLOR_RESET}\n" +fi -- GitLab