diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /scripts/lint-doc.sh | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) | |
download | gitlab-ce-7e9c479f7de77702622631cff2628a9c8dcbc627.tar.gz |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'scripts/lint-doc.sh')
-rwxr-xr-x | scripts/lint-doc.sh | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh index 87256269de2..9ae6ce400da 100755 --- a/scripts/lint-doc.sh +++ b/scripts/lint-doc.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash +set -o pipefail -cd "$(dirname "$0")/.." +cd "$(dirname "$0")/.." || exit 1 echo "=> Linting documents at path $(pwd) as $(whoami)..." echo ERRORCODE=0 @@ -65,8 +66,11 @@ then else MERGE_BASE=$(git merge-base ${CI_MERGE_REQUEST_TARGET_BRANCH_SHA} ${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}) MD_DOC_PATH=$(git diff --name-only "${MERGE_BASE}..${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}" 'doc/*.md') - echo -e "Merged results pipeline detected. Testing only the following files:\n${MD_DOC_PATH}" - fi + if [ -n "${MD_DOC_PATH}" ] + then + echo -e "Merged results pipeline detected. Testing only the following files:\n${MD_DOC_PATH}" + fi +fi function run_locally_or_in_docker() { local cmd=$1 @@ -77,7 +81,7 @@ function run_locally_or_in_docker() { $cmd $args elif hash docker 2>/dev/null then - docker run -t -v ${PWD}:/gitlab -w /gitlab --rm registry.gitlab.com/gitlab-org/gitlab-docs/lint:latest ${cmd} ${args} + docker run -t -v ${PWD}:/gitlab -w /gitlab --rm registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.12-vale-2.6.1-markdownlint-0.24.0 ${cmd} ${args} else echo echo " ✖ ERROR: '${cmd}' not found. Install '${cmd}' or Docker to proceed." >&2 @@ -96,10 +100,15 @@ function run_locally_or_in_docker() { echo '=> Linting markdown style...' echo -run_locally_or_in_docker 'markdownlint' "--config .markdownlint.json ${MD_DOC_PATH}" +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.json ${MD_DOC_PATH}" +fi echo '=> Linting prose...' -run_locally_or_in_docker 'vale' "--minAlertLevel error ${MD_DOC_PATH}" +run_locally_or_in_docker 'vale' "--minAlertLevel error --output=doc/.vale/vale.tmpl ${MD_DOC_PATH}" if [ $ERRORCODE -ne 0 ] then |