Set NODE_PATH to allow markdownlint scripts to run global packages
What does this MR do and why?
Adds the NODE_PATH
environment variable to our markdownlint Docker image. In order to use functions from the markdownlint-rule-helpers
package in our new markdownlint rules, we need to define the node path since we're installing node modules globally.
https://nodejs.org/api/modules.html#loading-from-the-global-folders
This should clear up the module resolution error here: https://gitlab.com/gitlab-org/gitlab/-/jobs/3225086678
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
Check out this branch. -
Build the docs-lint-markdown
image locally:docker build - < dockerfiles/gitlab-docs-lint-markdown.Dockerfile --build-arg ALPINE_VERSION="3.16" --build-arg VALE_VERSION="2.20.1" --build-arg MARKDOWNLINT_VERSION="0.32.2" -t "docs-markdownlint-test"
-
Run the image and enter a bash shell in the container: docker run -it docs-markdownlint-test /bin/bash
-
Clone the GitLab project, on the branch with the markdownlint rules MR: mkdir -p build/gitlab-org && git clone -b sarahgerman/markdownlint-rules-docs-tabs https://gitlab.com/gitlab-org/gitlab.git build/gitlab-org/gitlab
-
Run the lint-doc script: ./build/gitlab-org/gitlab/scripts/lint-doc.sh
The script should completely run without errors.
Merge request acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this merge request.