mirror of https://github.com/grafana/grafana.git
Update `make docs` procedure (#103574)
Co-authored-by: grafanabot <bot@grafana.com> Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
This commit is contained in:
parent
f4dbbbac0c
commit
2575ebe1fb
18
docs/docs.mk
18
docs/docs.mk
|
@ -31,9 +31,6 @@ ifeq ($(PROJECTS),)
|
|||
$(error "PROJECTS variable must be defined in variables.mk")
|
||||
endif
|
||||
|
||||
# First project is considered the primary one used for doc-validator.
|
||||
PRIMARY_PROJECT := $(subst /,-,$(firstword $(subst :, ,$(firstword $(PROJECTS)))))
|
||||
|
||||
# Host port to publish container port to.
|
||||
ifeq ($(origin DOCS_HOST_PORT), undefined)
|
||||
export DOCS_HOST_PORT := 3002
|
||||
|
@ -44,12 +41,7 @@ ifeq ($(origin DOCS_IMAGE), undefined)
|
|||
export DOCS_IMAGE := grafana/docs-base:latest
|
||||
endif
|
||||
|
||||
# Container image used for doc-validator linting.
|
||||
ifeq ($(origin DOC_VALIDATOR_IMAGE), undefined)
|
||||
export DOC_VALIDATOR_IMAGE := grafana/doc-validator:latest
|
||||
endif
|
||||
|
||||
# Container image used for vale linting.
|
||||
# Container image used for Vale linting.
|
||||
ifeq ($(origin VALE_IMAGE), undefined)
|
||||
export VALE_IMAGE := grafana/vale:latest
|
||||
endif
|
||||
|
@ -99,14 +91,6 @@ docs-debug: ## Run Hugo web server with debugging enabled. TODO: support all SER
|
|||
docs-debug: make-docs
|
||||
WEBSITE_EXEC='hugo server --bind 0.0.0.0 --port 3002 --debug' $(CURDIR)/make-docs $(PROJECTS)
|
||||
|
||||
.PHONY: doc-validator
|
||||
doc-validator: ## Run doc-validator on the entire docs folder which includes pulling the latest `DOC_VALIDATOR_IMAGE` (default: `grafana/doc-validator:latest`) container image. To not pull the image, set `PULL=false`.
|
||||
doc-validator: make-docs
|
||||
ifeq ($(PULL), true)
|
||||
$(PODMAN) pull -q $(DOC_VALIDATOR_IMAGE)
|
||||
endif
|
||||
DOCS_IMAGE=$(DOC_VALIDATOR_IMAGE) $(CURDIR)/make-docs $(PROJECTS)
|
||||
|
||||
.PHONY: vale
|
||||
vale: ## Run vale on the entire docs folder which includes pulling the latest `VALE_IMAGE` (default: `grafana/vale:latest`) container image. To not pull the image, set `PULL=false`.
|
||||
vale: make-docs
|
||||
|
|
|
@ -8,6 +8,14 @@
|
|||
# [Semantic versioning](https://semver.org/) is used to help the reader identify the significance of changes.
|
||||
# Changes are relevant to this script and the support docs.mk GNU Make interface.
|
||||
#
|
||||
# ## 9.0.0 (2025-04-05)
|
||||
#
|
||||
# ### Removed
|
||||
#
|
||||
# - doc-validator target and associated scripts.
|
||||
#
|
||||
# Most useful rules have been migrated to Vale and the others are often false positives.
|
||||
#
|
||||
# ## 8.5.2 (2025-02-28)
|
||||
#
|
||||
# ### Fixed
|
||||
|
@ -831,51 +839,6 @@ ${DOCS_IMAGE}
|
|||
POSIX_HERESTRING
|
||||
|
||||
case "${image}" in
|
||||
'grafana/doc-validator')
|
||||
proj="$(new_proj "$1")"
|
||||
printf '\r\n'
|
||||
|
||||
IFS='' read -r cmd <<EOF
|
||||
${PODMAN} run \
|
||||
--init \
|
||||
--interactive \
|
||||
--platform linux/amd64 \
|
||||
--rm \
|
||||
--tty \
|
||||
${volumes} \
|
||||
${DOCS_IMAGE} \
|
||||
--include=${DOC_VALIDATOR_INCLUDE} \
|
||||
--skip-checks=${DOC_VALIDATOR_SKIP_CHECKS} \
|
||||
/hugo/content$(proj_canonical "${proj}") \
|
||||
"$(proj_canonical "${proj}") \
|
||||
| sed "s#$(proj_dst "${proj}")#sources#"
|
||||
EOF
|
||||
|
||||
if [ -n "${DEBUG}" ]; then
|
||||
debg "${cmd}"
|
||||
fi
|
||||
|
||||
case "${OUTPUT_FORMAT}" in
|
||||
human)
|
||||
if ! command -v jq >/dev/null 2>&1; then
|
||||
# shellcheck disable=SC2016
|
||||
errr '`jq` must be installed for the `doc-validator` target to work.'
|
||||
# shellcheck disable=SC2016
|
||||
note 'To install `jq`, refer to https://jqlang.github.io/jq/download/,'
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
${cmd} \
|
||||
| jq -r '"ERROR: \(.location.path):\(.location.range.start.line // 1):\(.location.range.start.column // 1): \(.message)" + if .suggestions[0].text then "\nSuggestion: \(.suggestions[0].text)" else "" end'
|
||||
;;
|
||||
json)
|
||||
${cmd}
|
||||
;;
|
||||
*) # default
|
||||
errr "Invalid output format '${OUTPUT_FORMAT}'"
|
||||
esac
|
||||
;;
|
||||
'grafana/vale')
|
||||
proj="$(new_proj "$1")"
|
||||
printf '\r\n'
|
||||
|
|
Loading…
Reference in New Issue