2021-02-23 17:21:54 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
# Generate helm-docs for Helm charts
|
|
|
|
# Usage ./gen-helm-docs.sh [chart]
|
|
|
|
|
|
|
|
# require helm-docs
|
|
|
|
command -v helm-docs >/dev/null 2>&1 || {
|
|
|
|
echo >&2 "helm-docs is not installed. Aborting."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Absolute path of repository
|
|
|
|
repository=$(git rev-parse --show-toplevel)
|
|
|
|
|
|
|
|
# Templates to copy into each chart directory
|
2021-05-30 11:14:37 +00:00
|
|
|
readme_template="${repository}/tools/templates/docs/README.md.gotmpl"
|
|
|
|
config_template="${repository}/tools/templates/docs/CONFIG.md.gotmpl"
|
2021-02-23 17:21:54 +00:00
|
|
|
root="${repository}"
|
|
|
|
|
2021-05-09 11:31:49 +00:00
|
|
|
for train in stable incubator develop non-free deprecated; do
|
2021-06-11 15:24:57 +00:00
|
|
|
for chart in charts/${train}/*; do
|
2021-05-09 10:47:53 +00:00
|
|
|
if [ -d "${chart}" ]; then
|
|
|
|
maxchartversion=$(cat ${chart}/Chart.yaml | grep "^version: " | awk -F" " '{ print $2 }')
|
|
|
|
chartname=$(basename ${chart})
|
|
|
|
echo "-] Copying templates to ${repository}/${chart}"
|
|
|
|
helm-docs \
|
|
|
|
--ignore-file=".helmdocsignore" \
|
|
|
|
--output-file="README.md" \
|
2021-05-30 11:14:37 +00:00
|
|
|
--template-files="${repository}/tools/templates/docs/README.md.gotmpl" \
|
2021-05-09 10:47:53 +00:00
|
|
|
--chart-search-root="${chart}"
|
|
|
|
helm-docs \
|
|
|
|
--ignore-file=".helmdocsignore" \
|
|
|
|
--output-file="CONFIG.md" \
|
2021-05-30 11:14:37 +00:00
|
|
|
--template-files="${repository}/tools/templates/docs/CONFIG.md.gotmpl" \
|
2021-05-09 10:47:53 +00:00
|
|
|
--chart-search-root="${chart}"
|
|
|
|
fi
|
|
|
|
done
|
2021-02-23 17:21:54 +00:00
|
|
|
done
|