Skip to content

Commit

Permalink
added helm schema-gen plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhuth committed Sep 21, 2023
1 parent 50a771e commit d29d3d1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ helm plugin install --version=v${HELM_LOCAL_CHART_VERSION_PLUGIN_VERSION} https:
helm local-chart-version version
EOF

# Helm schema-gen plugin
# renovate: datasource=github-releases depName=knechtionscoding/helm-schema-gen
ARG HELM_SCHEMA_GEN_PLUGIN_VERSION=0.0.10
RUN <<EOF
helm plugin install --version=v${HELM_SCHEMA_GEN_PLUGIN_VERSION} https://github.com/knechtionscoding/helm-schema-gen
helm schema-gen --help
EOF

# Chart Doc Gen
# renovate: datasource=github-releases depName=kubepack/chart-doc-gen
ARG CHART_DOC_GEN_VERSION=0.4.7
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ bash-5.1# CHARTS_DIR=samples/charts chart-powerlint.sh
You can auto-generate and format Markdown docs from the chart's values.yaml using [generate-docs.sh](scripts/generate-docs.sh).
This scripts uses either `chart-doc-gen` if the chart dir contains a `doc.yaml`, or `helm-docs` if it doesn't.

### Generating Chart Schemas

You can auto-generate the Helm schema from the chart's values.yaml using [generate-schemas.sh](scripts/generate-schemas.sh).

### Generating CHANGELOG files

Finally, there's [generate-chart-changelog.sh](scripts/generate-chart-changelog.sh), which can be used to generate a CHANGELOG.md file from
Expand All @@ -55,6 +59,7 @@ You can use this file in conjunction with the [chart-releaser](https://github.co
- [kubectl](https://github.com/kubernetes/kubectl)
- [helm](https://github.com/helm/helm)
- [helm push plugin](https://github.com/chartmuseum/helm-push.git)
- [helm schema-gen plugin](https://github.com/knechtionscoding/helm-schema-gen.git)
- [helm-local-chart-version](https://github.com/mbenabda/helm-local-chart-version)
- [chart-doc-gen](https://github.com/kubepack/chart-doc-gen)
- [kubeval](https://github.com/instrumenta/kubeval)
Expand Down
18 changes: 18 additions & 0 deletions scripts/generate-schemas.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -euox pipefail

echo "Running schema-gen..."

CHARTS_DIR=${CHARTS_DIR:-"charts"}

for chart in "${CHARTS_DIR}"/*; do
echo "Generating schema for $chart:"

if test ! -f "${chart}/Chart.yaml"; then
echo "No 'Chart.yaml' found in directory ${chart}. Skipping."
continue
fi

helm schema-gen ${chart}/values.yaml > ${chart}/values.schema.json

done

0 comments on commit d29d3d1

Please sign in to comment.