Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-17 03:09:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-17 03:09:32 +0300
commit1b1bd461da768b31adb730f42060b7d6adf548c5 (patch)
treef0150b942ee4e9f5798418aad6da669de6ace00b /scripts
parent2c34e41161b78fddbdff9a858086e95558e06ba0 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/lint-doc.sh26
1 files changed, 20 insertions, 6 deletions
diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh
index 6fb5dfbd6e8..18e7d7d1c1c 100755
--- a/scripts/lint-doc.sh
+++ b/scripts/lint-doc.sh
@@ -119,19 +119,25 @@ else
fi
fi
-function run_locally_or_in_docker() {
+function run_locally_or_in_container() {
local cmd=$1
local args=$2
+ local registry_url="registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.16-vale-2.22.0-markdownlint-0.32.2-markdownlint2-0.6.0"
if hash ${cmd} 2>/dev/null
then
$cmd $args
- elif hash docker 2>/dev/null
+ # 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)
then
- docker run -t -v ${PWD}:/gitlab -w /gitlab --rm registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.16-vale-2.22.0-markdownlint-0.32.2-markdownlint2-0.6.0 ${cmd} ${args}
+ nerdctl run -t -v "${PWD}:/gitlab" -w /gitlab --rm ${registry_url} ${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_url} ${cmd} ${args}
else
echo
- echo " ✖ ERROR: '${cmd}' not found. Install '${cmd}' or Docker to proceed." >&2
+ echo " ✖ ERROR: '${cmd}' not found. Install '${cmd}' or a container runtime (Docker/Nerdctl) to proceed." >&2
echo
((ERRORCODE++))
fi
@@ -151,11 +157,19 @@ if [ -z "${MD_DOC_PATH}" ]
then
echo "Merged results pipeline detected, but no markdown files found. Skipping."
else
- run_locally_or_in_docker 'markdownlint' "--config .markdownlint.yml ${MD_DOC_PATH} --rules doc/.markdownlint/rules"
+ 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
fi
echo '=> Linting prose...'
-run_locally_or_in_docker 'vale' "--minAlertLevel error --output=doc/.vale/vale.tmpl ${MD_DOC_PATH}"
+run_locally_or_in_container 'vale' "--minAlertLevel error --output=doc/.vale/vale.tmpl ${MD_DOC_PATH}"
if [ $ERRORCODE -ne 0 ]
then