Skip to content

Commit

Permalink
📖 Generate probe markdown documentation (#4184)
Browse files Browse the repository at this point in the history
* generate probe markdown documentation

Walks the various probes def.yaml files and puts them in a single
markdown document. This doesn't currently include the remediation, but
neither does the existing checks.md document either.

In order to avoid duplicating yaml definitions, this existing ones were
moved to an internal directory so they can be reused.

Signed-off-by: Spencer Schrock <[email protected]>

* fix linter

Signed-off-by: Spencer Schrock <[email protected]>

* add probe doc generation to Makefile

Note: There is no validate-docs step for the probes code, as the
def.yml fields are validated elsewhere currently in the unit tests.

Signed-off-by: Spencer Schrock <[email protected]>

* fix license for new yaml package

Signed-off-by: Spencer Schrock <[email protected]>

---------

Signed-off-by: Spencer Schrock <[email protected]>
  • Loading branch information
spencerschrock authored Jun 20, 2024
1 parent 5d08c1c commit 0d57c02
Show file tree
Hide file tree
Showing 6 changed files with 732 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:
command: |
go env -w GOFLAGS=-mod=mod
make generate-docs
- name: ensure checks.yaml and checks.md match
- name: ensure generated check and probe documentation match the source
run: git diff --exit-code
build-proto:
name: build-proto
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,14 @@ cmd/internal/nuget/nuget_mockclient.go: cmd/internal/nuget/client.go | $(MOCKGEN
# Generating MockNugetClient
$(MOCKGEN) -source=cmd/internal/nuget/client.go -destination=cmd/internal/nuget/nuget_mockclient.go -package=nuget -copyright_file=clients/mockclients/license.txt

PROBE_DEFINITION_FILES = $(shell find ./probes/ -name "def.yml")
generate-docs: ## Generates docs
generate-docs: validate-docs docs/checks.md docs/checks/internal/checks.yaml docs/checks/internal/*.go docs/checks/internal/generate/*.go
generate-docs: validate-docs docs/checks.md docs/checks/internal/checks.yaml docs/checks/internal/*.go docs/checks/internal/generate/*.go \
docs/probes.md $(PROBE_DEFINITION_FILES) docs/probes/internal/generate/*.go
# Generating checks.md
go run ./docs/checks/internal/generate/main.go docs/checks.md
# Generating probes.md
go run ./docs/probes/internal/generate/main.go probes/ > docs/probes.md

validate-docs: docs/checks/internal/generate/main.go
# Validating checks.yaml
Expand Down
Loading

0 comments on commit 0d57c02

Please sign in to comment.