-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: introduce workflow for helm documentation validation (#454)
Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com> Signed-off-by: odubajDT <93584209+odubajDT@users.noreply.github.com> Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
- Loading branch information
Showing
6 changed files
with
193 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# Readme generator for OpenFeature Operator Helm Chart | ||
# | ||
# This script will install the readme generator if it's not installed already | ||
# and then it will generate the README.md file from the local Helm values | ||
# | ||
# Dependencies: | ||
# Node >=16 | ||
|
||
# renovate: datasource=github-releases depName=bitnami-labs/readme-generator-for-helm | ||
GENERATOR_VERSION="2.5.0" | ||
|
||
echo "Checking if readme generator is installed already..." | ||
if [[ $(npm list -g | grep -c "readme-generator-for-helm@${GENERATOR_VERSION}") -eq 0 ]]; then | ||
echo "Readme Generator v${GENERATOR_VERSION} not installed, installing now..." | ||
git clone https://github.com/bitnami-labs/readme-generator-for-helm.git | ||
cd ./readme-generator-for-helm || exit | ||
git checkout ${GENERATOR_VERSION} | ||
npm ci | ||
cd .. | ||
npm install -g ./readme-generator-for-helm | ||
else | ||
echo "Readme Generator is already installed, continuing..." | ||
fi | ||
|
||
echo "Generating readme now..." | ||
readme-generator --config $(pwd)/chart/open-feature-operator/helm-docs-config.json --values=./chart/open-feature-operator/values.yaml --readme=./chart/open-feature-operator/README.md | ||
|
||
# Please be aware, the readme file needs to exist and needs to have a Parameters section, as only this section will be re-generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Validate Helm Docs | ||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
paths: | ||
- 'chart/**' | ||
defaults: | ||
run: | ||
shell: bash | ||
jobs: | ||
check-helm-docs: | ||
name: Check helm documentation values | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node | ||
uses: actions/setup-node@v3.6.0 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Generate helm charts | ||
env: | ||
RELEASE_REGISTRY: ghcr.io/openfeature | ||
run: make helm-package | ||
|
||
- name: Install readme generator | ||
run: | | ||
git clone https://github.com/bitnami-labs/readme-generator-for-helm.git | ||
cd ./readme-generator-for-helm | ||
npm ci | ||
npm install --location=global ./ | ||
cd .. | ||
- name: Check Helm doc up to date | ||
run: | | ||
cd ./chart/open-feature-operator/ | ||
cp ./README.md ./README-old.md | ||
readme-generator --config $(pwd)/helm-docs-config.json --values=./values.yaml --readme=./README.md | ||
if ! cmp --quiet ./README-old.md ./README.md; then | ||
echo "The Helm values have changes that are not reflected in the readme. Please use ./.github/scripts/generate-helm-docs.sh to re-generate the docs." | ||
echo "" | ||
echo "=========== Diff ===========" | ||
diff -u ./README-old.md ./README.md | ||
exit 1 | ||
else | ||
echo "" | ||
echo "Helm values documentation is correct!" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.