Skip to content

Commit 2790960

Browse files
chore: update helm-docs pre-commit hooks
1 parent 52ec060 commit 2790960

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

.gitlab-ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ test:
4141
- set -euo pipefail
4242
- apk update && apk upgrade
4343
- apk add --no-cache shellcheck shfmt pre-commit
44-
- go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest
4544
- pre-commit run --verbose --all-files --show-diff-on-failure
4645
coverage: /total:\s+\(statements\)\s+\d+.\d+%/
4746
artifacts:

.pre-commit-config.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ repos:
6060
- --sequence=4
6161
- --offset=2
6262
exclude: (config|helm)/.*\.(yaml|yml)
63-
- repo: https://github.com/norwoodj/helm-docs
64-
rev: v1.14.2
65-
hooks:
66-
- id: helm-docs
67-
args:
68-
- --chart-search-root=helm
6963
- repo: https://github.com/pecigonzalo/pre-commit-shfmt
7064
rev: v2.2.0
7165
hooks:
@@ -88,6 +82,14 @@ repos:
8882
- id: go-build-mod
8983
- repo: local
9084
hooks:
85+
# https://github.com/norwoodj/helm-docs/blob/master/.pre-commit-hooks.yaml
86+
- id: make-helm-docs
87+
name: make-helm-docs
88+
entry: make helm-docs
89+
files: (README\.md\.gotmpl|(Chart|requirements|values)\.yaml)$
90+
language: system
91+
require_serial: true
92+
pass_filenames: false
9193
- id: make-helm-validate
9294
name: Make Helm Validate
9395
entry: make helm-validate

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen-$(CONTROLLER_TOOLS_VERSION)
155155
ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
156156
GOVULNCHECK ?= $(LOCALBIN)/govulncheck-$(GOVULNCHECK_VERSION)
157157
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
158+
HELM_DOCS ?= $(LOCALBIN)/helm-docs-$(HELM_DOCS_VERSION)
158159

159160
## Tool Versions
160161
KUSTOMIZE_VERSION ?= v5.4.3
@@ -164,6 +165,7 @@ ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -
164165
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
165166
GOVULNCHECK_VERSION ?= latest
166167
GOLANGCI_LINT_VERSION ?= v2.1.6
168+
HELM_DOCS_VERSION ?= v1.14.2
167169

168170
.PHONY: kustomize
169171
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -191,6 +193,11 @@ $(GOLANGCI_LINT): $(LOCALBIN)
191193
wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(LOCALBIN) $(GOLANGCI_LINT_VERSION)
192194
mv $(LOCALBIN)/golangci-lint $(GOLANGCI_LINT)
193195

196+
.PHONY: helm-docs-bin
197+
helm-docs-bin: $(HELM_DOCS) ## Download helm-docs locally if necessary.
198+
$(HELM_DOCS): $(LOCALBIN)
199+
$(call go-install-tool,$(HELM_DOCS),github.com/norwoodj/helm-docs/cmd/helm-docs,$(HELM_DOCS_VERSION))
200+
194201
.PHONY: operator-sdk
195202
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
196203
operator-sdk: ## Download operator-sdk locally if necessary.
@@ -212,14 +219,17 @@ endif
212219

213220
.PHONY: install-dev
214221
install-dev: ## Install binaries for development environment.
215-
go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest
216222
go install github.com/go-delve/delve/cmd/dlv@latest
217223
go install sigs.k8s.io/kind@latest
218224
go install sigs.k8s.io/cloud-provider-kind@latest
219225

220226
.PHONY: helm-validate
221227
helm-validate: helm-dependency-update helm-lint ## Validate Helm charts.
222228

229+
.PHONY: helm-docs
230+
helm-docs: helm-docs-bin ## Run helm-docs.
231+
$(HELM_DOCS) --chart-search-root=helm
232+
223233
.PHONY: helm-lint
224234
helm-lint: ## Lint Helm charts.
225235
find "helm/" -depth -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0r -n1 helm lint --strict

0 commit comments

Comments
 (0)