Skip to content

Commit

Permalink
feat: Add a make rule to generate helm docs (#398)
Browse files Browse the repository at this point in the history
It's going to be easier for contributors, if they don't have to figure
out the way to update README.md. So, I guess, it makes sense to have a
Makefile with a corresponding rule.
  • Loading branch information
allanger authored Nov 19, 2023
1 parent 098edd5 commit 885c365
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions helm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: sql-exporter
description: Database agnostic SQL exporter for Prometheus
type: application
version: 0.2.2
version: 0.2.3
appVersion: 0.13.0
keywords:
- exporter
Expand Down
8 changes: 8 additions & 0 deletions helm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)

.PHONY: gen_docs
gen_docs: ## Generate helm documentation
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest
./bin/helm-docs --template-files=./README.md.gotmpl --sort-values-order file
4 changes: 4 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,7 @@ helm install sql_exporter/sql-exporter
To configure `target`, `jobs`, `collector_files` please refer to the [documentation](https://github.com/burningalchemist/sql_exporter/blob/master/documentation/sql_exporter.yml) in the source repository. These values are not set by default.

It's also possible to define collectors (i.e. metrics and queries) in separate files, and specify the filenames in the `collector_files` list. For that we can use `CollectorFiles` field (check `values.yaml` for the available example).

## Dev Notes

After updating default `Values`, please execute `make gen_docs` to update the `README.md` file
4 changes: 4 additions & 0 deletions helm/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ helm install sql_exporter/sql-exporter
To configure `target`, `jobs`, `collector_files` please refer to the [documentation](https://github.com/burningalchemist/sql_exporter/blob/master/documentation/sql_exporter.yml) in the source repository. These values are not set by default.

It's also possible to define collectors (i.e. metrics and queries) in separate files, and specify the filenames in the `collector_files` list. For that we can use `CollectorFiles` field (check `values.yaml` for the available example).

## Dev Notes

After changing default `Values`, please execute `make gen_docs` to update the `README.md` file. Readme file is generated by the `helm-docs` tool, so make sure not to edit it manually.

0 comments on commit 885c365

Please sign in to comment.