diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-23 18:09:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-23 18:09:45 +0300 |
commit | 99c1dfd5e3f39868d65cb006078a8d091992fa54 (patch) | |
tree | 18d970852272c6d5ba303911da13d16cbff2514c /scripts/lint-doc.sh | |
parent | 23634aa773e10e7df79247fb6fddbce88b825909 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts/lint-doc.sh')
-rwxr-xr-x | scripts/lint-doc.sh | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh index 1c934c07608..68dfac95ef6 100755 --- a/scripts/lint-doc.sh +++ b/scripts/lint-doc.sh @@ -119,24 +119,19 @@ else fi fi -function run_locally_or_in_container() { +function run_locally_or_in_docker() { local cmd=$1 local args=$2 if hash ${cmd} 2>/dev/null then $cmd $args - # When using software like Rancher Desktop, both nerdctl and docker binaries are available - # but only one is configured. To check which one to use, we need to probe each runtime - elif (hash nerdctl 2>/dev/null) && (nerdctl info 2>&1 1>/dev/null) + elif hash docker 2>/dev/null then - nerdctl run -t -v "${PWD}:/gitlab" -w /gitlab --rm registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.16-vale-2.20.1-markdownlint-0.32.2 ${cmd} ${args} - elif (hash docker 2>/dev/null) && (docker info 2>&1 1>/dev/null) - then - docker run -t -v "${PWD}:/gitlab" -w /gitlab --rm registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.16-vale-2.20.1-markdownlint-0.32.2 ${cmd} ${args} + docker run -t -v ${PWD}:/gitlab -w /gitlab --rm registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.16-vale-2.20.1-markdownlint-0.32.2 ${cmd} ${args} else echo - echo " ✖ ERROR: '${cmd}' not found. Install '${cmd}' or a container runtime (Docker/Nerdctl) to proceed." >&2 + echo " ✖ ERROR: '${cmd}' not found. Install '${cmd}' or Docker to proceed." >&2 echo ((ERRORCODE++)) fi @@ -156,19 +151,11 @@ if [ -z "${MD_DOC_PATH}" ] then echo "Merged results pipeline detected, but no markdown files found. Skipping." else - yarn markdownlint --config .markdownlint.yml ${MD_DOC_PATH} --rules doc/.markdownlint/rules - - if [ $? -ne 0 ] - then - echo - echo '✖ ERROR: Markdownlint failed with errors.' >&2 - echo - ((ERRORCODE++)) - fi + run_locally_or_in_docker 'markdownlint' "--config .markdownlint.yml ${MD_DOC_PATH} --rules doc/.markdownlint/rules" fi echo '=> Linting prose...' -run_locally_or_in_container 'vale' "--minAlertLevel error --output=doc/.vale/vale.tmpl ${MD_DOC_PATH}" +run_locally_or_in_docker 'vale' "--minAlertLevel error --output=doc/.vale/vale.tmpl ${MD_DOC_PATH}" if [ $ERRORCODE -ne 0 ] then |