From 97e4bfae06618a9e212dee0dda19d2a9cf40c39a Mon Sep 17 00:00:00 2001 From: liyang Date: Thu, 14 Dec 2023 20:40:24 +0800 Subject: [PATCH 1/5] feat: add check-update-docs scripts --- .github/scripts/check-update-docs.sh | 30 ++++++++++++++++++++++++++++ .github/workflows/ci.yaml | 4 ++++ Makefile | 6 ++++++ 3 files changed, 40 insertions(+) create mode 100644 .github/scripts/check-update-docs.sh diff --git a/.github/scripts/check-update-docs.sh b/.github/scripts/check-update-docs.sh new file mode 100644 index 0000000..67e4075 --- /dev/null +++ b/.github/scripts/check-update-docs.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +TMP_DIR=/tmp/greptime-chart-tmp +CHART_DIRS=(charts) + +function copy_original_files() { + rm -rf "${TMP_DIR}" + mkdir -p "${TMP_DIR}" + for dir in "${CHART_DIRS[@]}"; do + cp -r "${dir}" "${TMP_DIR}"/"${dir}" + done +} + +function run_update_docs() { + make update-docs +} + +function check_diff() { + for dir in "${CHART_DIRS[@]}"; do + diff -Naupr "${dir}" "${TMP_DIR}"/"${dir}" || (echo \'"${dir}"/\' is out of date, please run \'make update-docs\' && exit 1) + done +} + +copy_original_files +run_update_docs +check_diff diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1605171..18f1d5a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,6 +11,10 @@ jobs: with: fetch-depth: 0 + - name: Check update docs + run: | + make check-update-docs + - name: Install Helm uses: azure/setup-helm@v3 with: diff --git a/Makefile b/Makefile index d9b3b4b..5f612a8 100644 --- a/Makefile +++ b/Makefile @@ -16,3 +16,9 @@ update-docs: install-helm-docs ## Run helm-docs $(GOBIN)/helm-docs -c charts/greptimedb-cluster --chart-search-root=charts/greptimedb-cluster --template-files=README.md.gotmpl $(GOBIN)/helm-docs -c charts/greptimedb-operator --chart-search-root=charts/greptimedb-operator --template-files=README.md.gotmpl $(GOBIN)/helm-docs -c charts/greptimedb-standalone --chart-search-root=charts/greptimedb-standalone --template-files=README.md.gotmpl + +.PHONY: check-update-docs +check-update-docs: ## Check update docs. + echo "Checking update docs" + .github/scripts/check-update-docs.sh + From 1f927afdfdf708cac3dc36622c0b48548343b8c0 Mon Sep 17 00:00:00 2001 From: liyang Date: Thu, 14 Dec 2023 20:44:33 +0800 Subject: [PATCH 2/5] chore: run policy --- .github/scripts/check-update-docs.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .github/scripts/check-update-docs.sh diff --git a/.github/scripts/check-update-docs.sh b/.github/scripts/check-update-docs.sh old mode 100644 new mode 100755 From aed865214927724ec738a69c2ca7559558a052f5 Mon Sep 17 00:00:00 2001 From: liyang Date: Fri, 15 Dec 2023 12:12:34 +0800 Subject: [PATCH 3/5] refactor: check docs --- .github/scripts/check-update-docs.sh | 30 ---------------------------- .github/workflows/ci.yaml | 4 ++-- Makefile | 14 ++++++------- 3 files changed, 9 insertions(+), 39 deletions(-) delete mode 100755 .github/scripts/check-update-docs.sh diff --git a/.github/scripts/check-update-docs.sh b/.github/scripts/check-update-docs.sh deleted file mode 100755 index 67e4075..0000000 --- a/.github/scripts/check-update-docs.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -o pipefail - -TMP_DIR=/tmp/greptime-chart-tmp -CHART_DIRS=(charts) - -function copy_original_files() { - rm -rf "${TMP_DIR}" - mkdir -p "${TMP_DIR}" - for dir in "${CHART_DIRS[@]}"; do - cp -r "${dir}" "${TMP_DIR}"/"${dir}" - done -} - -function run_update_docs() { - make update-docs -} - -function check_diff() { - for dir in "${CHART_DIRS[@]}"; do - diff -Naupr "${dir}" "${TMP_DIR}"/"${dir}" || (echo \'"${dir}"/\' is out of date, please run \'make update-docs\' && exit 1) - done -} - -copy_original_files -run_update_docs -check_diff diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 18f1d5a..eafb614 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,9 +11,9 @@ jobs: with: fetch-depth: 0 - - name: Check update docs + - name: Check docs run: | - make check-update-docs + make check-docs - name: Install Helm uses: azure/setup-helm@v3 diff --git a/Makefile b/Makefile index 5f612a8..dbd8a83 100644 --- a/Makefile +++ b/Makefile @@ -11,14 +11,14 @@ endif install-helm-docs: ## Install helm-docs tool go install github.com/norwoodj/helm-docs/cmd/helm-docs@${HELM_DOCS_VERSION} -.PHONY: update-docs -update-docs: install-helm-docs ## Run helm-docs +.PHONY: docs +docs: install-helm-docs ## Run helm-docs $(GOBIN)/helm-docs -c charts/greptimedb-cluster --chart-search-root=charts/greptimedb-cluster --template-files=README.md.gotmpl $(GOBIN)/helm-docs -c charts/greptimedb-operator --chart-search-root=charts/greptimedb-operator --template-files=README.md.gotmpl $(GOBIN)/helm-docs -c charts/greptimedb-standalone --chart-search-root=charts/greptimedb-standalone --template-files=README.md.gotmpl -.PHONY: check-update-docs -check-update-docs: ## Check update docs. - echo "Checking update docs" - .github/scripts/check-update-docs.sh - +.PHONY: check-docs +check-docs: docs ## Check docs + @git diff --quiet || \ + (echo "Need to update documentation, please run 'make docs'"; \ + exit 1) From a6a50be5fee557ae3a567289427994600365e02f Mon Sep 17 00:00:00 2001 From: liyang Date: Fri, 15 Dec 2023 12:14:09 +0800 Subject: [PATCH 4/5] test: check docs --- charts/greptimedb-cluster/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/greptimedb-cluster/values.yaml b/charts/greptimedb-cluster/values.yaml index c20976f..b54133b 100644 --- a/charts/greptimedb-cluster/values.yaml +++ b/charts/greptimedb-cluster/values.yaml @@ -20,7 +20,7 @@ resources: frontend: # -- Frontend replicas - replicas: 1 + replicas: 2 # -- Extra frontend config in toml format. config: "" From 86eae358a62104a4a19dc42964822da094ba0997 Mon Sep 17 00:00:00 2001 From: liyang Date: Fri, 15 Dec 2023 12:15:30 +0800 Subject: [PATCH 5/5] test: check docs --- charts/greptimedb-cluster/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/greptimedb-cluster/values.yaml b/charts/greptimedb-cluster/values.yaml index b54133b..c20976f 100644 --- a/charts/greptimedb-cluster/values.yaml +++ b/charts/greptimedb-cluster/values.yaml @@ -20,7 +20,7 @@ resources: frontend: # -- Frontend replicas - replicas: 2 + replicas: 1 # -- Extra frontend config in toml format. config: ""