From 795e188024989461f4bfaac92391db4006d20a63 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 5 Dec 2024 19:46:24 +0100 Subject: [PATCH] ci: rework docs-related workflow and make targets a bit This change continues an effort started earlier to make some make targets and ci workflows more consistent and systematic. see https://github.com/rook/rook/pull/14922 it adds a make target gen.helm-docs as an alias to helm-docs. Additionally, gen.docs is added as alias to docs. targets check.docs and check.helm-docs are removed because it was agreed that targets using git are of little value to developers. Their functionality is moved back into the corresponding docs workflow. xiFinally, the redundant "Check helm-docs" check is removed from the docs-check workflow Signed-off-by: Michael Adam --- .github/workflows/docs-check.yml | 6 +++--- Makefile | 14 ++------------ tests/scripts/validate_modified_files.sh | 6 +++++- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index af352b097..6261504f1 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -42,10 +42,10 @@ jobs: Documentation/**/*.md !Documentation/Helm-Charts - - name: Check helm-docs - run: make check.helm-docs - name: Check docs - run: make check.docs + run: | + make gen.docs + tests/scripts/validate_modified_files.sh docs - name: Install mkdocs and dependencies run: cd build/release/ && make deps.docs diff --git a/Makefile b/Makefile index 413f33f61..7d2b5e65b 100644 --- a/Makefile +++ b/Makefile @@ -194,6 +194,7 @@ gen-rbac: $(HELM) $(YQ) ## Generate RBAC from Helm charts gen.docs: docs docs: helm-docs +gen.helm-docs: helm-docs helm-docs: $(HELM_DOCS) ## Use helm-docs to generate documentation from helm charts $(HELM_DOCS) -c deploy/charts/rook-ceph \ -o ../../../Documentation/Helm-Charts/operator-chart.md \ @@ -204,17 +205,6 @@ helm-docs: $(HELM_DOCS) ## Use helm-docs to generate documentation from helm cha -t ../../../Documentation/Helm-Charts/ceph-cluster-chart.gotmpl.md \ -t ../../../Documentation/Helm-Charts/_templates.gotmpl -check.helm-docs: - @$(MAKE) helm-docs - @git diff --exit-code || { \ - echo "Please run 'make helm-docs' locally, commit the updated docs, and push the change. See https://rook.io/docs/rook/latest/Contributing/documentation/#making-docs" ; \ - exit 2 ; \ - }; -check.docs: - @$(MAKE) docs - @tests/scripts/validate_modified_files.sh docs - - docs-preview: ## Preview the documentation through mkdocs mkdocs serve @@ -229,7 +219,7 @@ generate: gen.codegen gen.crds gen.rbac gen.docs gen.crd-docs ## Update all gene .PHONY: all build.common -.PHONY: build build.all install test check vet fmt codegen gen.codegen gen.rbac gen.crds gen.crd-docs gen.docs generate mod.check clean distclean prune +.PHONY: build build.all install test check vet fmt codegen gen.codegen gen.rbac gen.crds gen.crd-docs gen.docs gen.helm-docs generate mod.check clean distclean prune # ==================================================================================== # Help diff --git a/tests/scripts/validate_modified_files.sh b/tests/scripts/validate_modified_files.sh index 27cdb13f7..9e117e791 100755 --- a/tests/scripts/validate_modified_files.sh +++ b/tests/scripts/validate_modified_files.sh @@ -10,6 +10,7 @@ CRD_ERR="changes found by 'make crds'. please run 'make crds' locally and update BUILD_ERR="changes found by make build', please commit your go.sum or other changed files" HELM_ERR="changes found by 'make gen-rbac'. please run 'make gen-rbac' locally and update your PR" DOCS_ERR="changes found by 'make docs'. please run 'make docs' locally and update your PR" +HELM_DOCS_ERR="changes found by 'make helm-docs'. please run 'make helm-docs' locally and update your PR" ############# # FUNCTIONS # @@ -33,6 +34,9 @@ case "$1" in docs) validate "$DOCS_ERR" ;; + helm-docs) + validate "$HELM_DOCS_ERR" + ;; codegen) validate "$CODEGEN_ERR" ;; @@ -49,6 +53,6 @@ case "$1" in validate "$HELM_ERR" ;; *) - echo $"Usage: $0 {docs|codegen|modcheck|crd|build|gen-rbac}" + echo $"Usage: $0 {docs|helm-docs|codegen|modcheck|crd|build|gen-rbac}" exit 1 esac