Add cmake render-docs target for integration doc generation (#21778)
Add a `render-docs` ninja target that automates the metadata.yaml to markdown pipeline. The target manages its own Python venv in the build directory and is never part of ALL, so it has zero impact on normal builds. Also add generated integration files and virtualenv/ to .gitignore.
vkalintiris committed
Feb 18, 2026 at 14:48 UTC
c21dd9ce9ccfd9531dc21d9ba4f6fbcc0de6efb2
4 files changed
+45
.gitignore
+5
@@ -115,6 +115,7 @@ docs/diagrams/plantuml.jar
115
116
# python virtual environment
117
venv/
118
+virtualenv/
119
.python-version
120
121
# debugging / profiling
@@ -146,6 +147,10 @@ test-driver
147
**/tests/*_testdriver.trs
148
python.d/python-modules-installer.sh
149
150
+# integration generated files
151
+integrations/integrations.js
152
+integrations/integrations.json
153
+
154
# documentation generated files
155
docs/generator/src
156
docs/generator/build
CMakeLists.txt
+6
@@ -4014,6 +4014,12 @@ if(OS_WINDOWS)
4014
install(DIRECTORY /usr/ssl DESTINATION usr)
4015
endif()
4016
4017
+#
4018
+# Optional: render integration docs from metadata.yaml
4019
+#
4020
+
4021
+include(NetdataRenderDocs)
4022
+
4023
#
4024
# Include packaging logic
4025
#
integrations/pip.sh
+2
@@ -1,3 +1,5 @@
1
#!/bin/sh
2
3
+# If you change these dependencies, also update the pip install command in
4
+# packaging/cmake/Modules/NetdataRenderDocs.cmake
5
exec pip install jsonschema referencing jinja2 ruamel.yaml
packaging/cmake/Modules/NetdataRenderDocs.cmake
new
+32
@@ -0,0 +1,32 @@
1
+# SPDX-License-Identifier: GPL-3.0-or-later
2
+# Optional target for regenerating integration documentation from metadata.yaml files.
3
+#
4
+# Usage:
5
+# ninja -C build render-docs
6
+#
7
+# This target is never part of ALL, so it has zero impact on normal builds.
8
+# On first invocation it creates a Python venv in the build directory and
9
+# installs the required packages. Subsequent runs reuse the existing venv.
10
+
11
+include_guard()
12
+
13
+set(_render_docs_venv_dir "${CMAKE_BINARY_DIR}/_render_docs_venv")
14
+set(_render_docs_venv_stamp "${_render_docs_venv_dir}/.stamp")
15
+set(_render_docs_scripts_dir "${CMAKE_SOURCE_DIR}/integrations")
16
+
17
+add_custom_command(
18
+ OUTPUT "${_render_docs_venv_stamp}"
19
+ DEPENDS "${_render_docs_scripts_dir}/pip.sh"
20
+ COMMAND python3 -m venv "${_render_docs_venv_dir}"
21
+ COMMAND "${_render_docs_venv_dir}/bin/pip" install -q jsonschema referencing jinja2 ruamel.yaml
22
+ COMMAND "${CMAKE_COMMAND}" -E touch "${_render_docs_venv_stamp}"
23
+ COMMENT "Creating Python venv for render-docs"
24
+)
25
+
26
+add_custom_target(render-docs
27
+ DEPENDS "${_render_docs_venv_stamp}"
28
+ COMMAND "${_render_docs_venv_dir}/bin/python3" "${_render_docs_scripts_dir}/gen_integrations.py"
29
+ COMMAND "${_render_docs_venv_dir}/bin/python3" "${_render_docs_scripts_dir}/gen_docs_integrations.py"
30
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
31
+ COMMENT "Generating integration documentation from metadata.yaml files"
32
+)