Skip to content

Commit 01a0976

Browse files
Update make docs procedure (#1506)
* Update `make docs` procedure * Update `make docs` procedure --------- Co-authored-by: grafanabot <[email protected]>
1 parent 30561f5 commit 01a0976

File tree

1 file changed

+40
-27
lines changed

1 file changed

+40
-27
lines changed

docs/make-docs

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,25 @@
66
# [Semantic versioning](https://semver.org/) is used to help the reader identify the significance of changes.
77
# Changes are relevant to this script and the support docs.mk GNU Make interface.
88
#
9+
# ## 5.4.0 (2024-02-12)
10+
#
11+
# ### Changed
12+
#
13+
# - Set `WEBSITE_MOUNTS=true` when a user includes the `website` project.
14+
#
15+
# Ensures consistent behavior across repositories.
16+
# To disable website mounts, add `export WEBSITE_MOUNTS := false` to your `variables.mk` or `variables.mk.local` file.
17+
# - Use website mounts and container volumes also when a user includes the `grafana-cloud` project.
18+
#
19+
# ## 5.3.0 (2024-02-08)
20+
#
21+
# ### Changed
22+
#
23+
# - Updated support for plugins monorepo now that multiple projects have been moved into it.
24+
# - Use `printf` instead of `echo` for better portability of output.
25+
#
26+
# https://www.in-ulm.de/~mascheck/various/echo+printf/
27+
#
928
# ## 5.2.0 (2024-01-18)
1029
#
1130
# ### Changed
@@ -197,8 +216,6 @@ readonly DOC_VALIDATOR_SKIP_CHECKS="${DOC_VALIDATOR_SKIP_CHECKS:-^image-}"
197216
readonly HUGO_REFLINKSERRORLEVEL="${HUGO_REFLINKSERRORLEVEL:-WARNING}"
198217
readonly VALE_MINALERTLEVEL="${VALE_MINALERTLEVEL:-error}"
199218
readonly WEBSITE_EXEC="${WEBSITE_EXEC:-make server-docs}"
200-
# If set, the docs-base image will run a prebuild script that sets up Hugo mounts.
201-
readonly WEBSITE_MOUNTS="${WEBSITE_MOUNTS:-}"
202219

203220
PODMAN="$(if command -v podman >/dev/null 2>&1; then echo podman; else echo docker; fi)"
204221

@@ -270,10 +287,7 @@ SOURCES_helm_charts_mimir_distributed='mimir'
270287
SOURCES_helm_charts_tempo_distributed='tempo'
271288
SOURCES_opentelemetry='opentelemetry-docs'
272289
SOURCES_plugins_grafana_datadog_datasource='datadog-datasource'
273-
SOURCES_plugins_grafana_jira_datasource='jira-datasource'
274-
SOURCES_plugins_grafana_mongodb_datasource='mongodb-datasource'
275290
SOURCES_plugins_grafana_oracle_datasource='oracle-datasource'
276-
SOURCES_plugins_grafana_splunk_datasource='splunk-datasource'
277291

278292
VERSIONS_as_code='UNVERSIONED'
279293
VERSIONS_grafana_cloud='UNVERSIONED'
@@ -284,10 +298,7 @@ VERSIONS_grafana_cloud_data_configuration_integrations='UNVERSIONED'
284298
VERSIONS_grafana_cloud_frontend_observability_faro_web_sdk='UNVERSIONED'
285299
VERSIONS_opentelemetry='UNVERSIONED'
286300
VERSIONS_plugins_grafana_datadog_datasource='latest'
287-
VERSIONS_plugins_grafana_jira_datasource='latest'
288-
VERSIONS_plugins_grafana_mongodb_datasource='latest'
289301
VERSIONS_plugins_grafana_oracle_datasource='latest'
290-
VERSIONS_plugins_grafana_splunk_datasource='latest'
291302
VERSIONS_technical_documentation='UNVERSIONED'
292303
VERSIONS_website='UNVERSIONED'
293304
VERSIONS_writers_toolkit='UNVERSIONED'
@@ -297,10 +308,7 @@ PATHS_helm_charts_mimir_distributed='docs/sources/helm-charts/mimir-distributed'
297308
PATHS_helm_charts_tempo_distributed='docs/sources/helm-charts/tempo-distributed'
298309
PATHS_mimir='docs/sources/mimir'
299310
PATHS_plugins_grafana_datadog_datasource='docs/sources'
300-
PATHS_plugins_grafana_jira_datasource='docs/sources'
301-
PATHS_plugins_grafana_mongodb_datasource='docs/sources'
302311
PATHS_plugins_grafana_oracle_datasource='docs/sources'
303-
PATHS_plugins_grafana_splunk_datasource='docs/sources'
304312
PATHS_tempo='docs/sources/tempo'
305313
PATHS_website='content'
306314

@@ -424,7 +432,7 @@ proj_url() {
424432
$1
425433
POSIX_HERESTRING
426434

427-
if [ "${_project}" = 'website' ]; then
435+
if [ "${_project}" = website ]; then
428436
echo "http://localhost:${DOCS_HOST_PORT}/docs/"
429437

430438
unset _project _version
@@ -458,7 +466,7 @@ proj_dst() {
458466
$1
459467
POSIX_HERESTRING
460468

461-
if [ "${_project}" = 'website' ]; then
469+
if [ "${_project}" = website ]; then
462470
echo '/hugo/content'
463471

464472
unset _project _version
@@ -517,7 +525,7 @@ proj_canonical() {
517525
$1
518526
POSIX_HERESTRING
519527

520-
if [ "${_project}" = 'website' ]; then
528+
if [ "${_project}" = website ]; then
521529
echo '/docs'
522530

523531
unset _project _version
@@ -586,32 +594,30 @@ await_build() {
586594
while [ "${i}" -ne "${max}" ]
587595
do
588596
sleep 1
589-
debg "Retrying request to webserver assuming the process is still starting up."
597+
debg "Retrying request to web server assuming the process is still starting up."
590598
i=$((i + 1))
591599

592600
if ${req} "${url}"; then
593-
echo
594-
echo "View documentation locally:"
601+
printf '\r\nView documentation locally:\r\n'
595602
for x in ${url_src_dst_vers}; do
596603
IFS='^' read -r url _ _ <<POSIX_HERESTRING
597604
$x
598605
POSIX_HERESTRING
599606

600607
if [ -n "${url}" ]; then
601608
if [ "${_url}" != "arbitrary" ]; then
602-
echo " ${url}"
609+
printf '\r %s\r\n' "${url}"
603610
fi
604611
fi
605612
done
606-
echo
607-
echo 'Press Ctrl+C to stop the server'
613+
printf '\r\nPress Ctrl+C to stop the server\r\n'
608614

609615
unset i max req url
610616
return
611617
fi
612618
done
613619

614-
echo
620+
printf '\r\n'
615621
errr 'The build was interrupted or a build error occurred, check the previous logs for possible causes.'
616622
note 'You might need to use Ctrl+C to end the process.'
617623

@@ -620,16 +626,16 @@ POSIX_HERESTRING
620626

621627
debg() {
622628
if [ -n "${DEBUG}" ]; then
623-
echo "DEBG: $1" >&2
629+
printf 'DEBG: %s\r\n' "$1" >&2
624630
fi
625631
}
626632

627633
errr() {
628-
echo "ERRR: $1" >&2
634+
printf 'ERRR: %s\r\n' "$1" >&2
629635
}
630636

631637
note() {
632-
echo "NOTE: $1" >&2
638+
printf 'NOTE: %s\r\n' "$1" >&2
633639
}
634640

635641
url_src_dst_vers="$(url_src_dst_vers "$@")"
@@ -641,9 +647,16 @@ for arg in "$@"; do
641647
IFS=: read -r _project _ _repo _ <<POSIX_HERESTRING
642648
${arg}
643649
POSIX_HERESTRING
644-
if [ "${_project}" = website ]; then
650+
if [ "${_project}" = website ] || [ "${_project}" = grafana-cloud ]; then
645651
note "Please be patient, building the website can take some time."
646652

653+
# If set, the docs-base image will run a prebuild script that sets up Hugo mounts.
654+
if [ "${WEBSITE_MOUNTS}" = false ]; then
655+
unset WEBSITE_MOUNTS
656+
else
657+
readonly WEBSITE_MOUNTS=true
658+
fi
659+
647660
_repo="$(repo_path website)"
648661
volumes="--volume=${_repo}/config:/hugo/config"
649662
volumes="${volumes} --volume=${_repo}/layouts:/hugo/layouts"
@@ -690,7 +703,7 @@ POSIX_HERESTRING
690703
case "${image}" in
691704
'grafana/doc-validator')
692705
proj="$(new_proj "$1")"
693-
echo
706+
printf '\r\n'
694707
"${PODMAN}" run \
695708
--init \
696709
--interactive \
@@ -706,7 +719,7 @@ case "${image}" in
706719
;;
707720
'grafana/vale')
708721
proj="$(new_proj "$1")"
709-
echo
722+
printf '\r\n'
710723
"${PODMAN}" run \
711724
--init \
712725
--interactive \

0 commit comments

Comments
 (0)