Migrate to readme-generator for helm maintained by bitnami (#431)
Co-authored-by: Krishnakumar Venkataraman <[email protected]> Co-authored-by: Marco Franssen <[email protected]>
This commit is contained in:
co-authored by
Krishnakumar Venkataraman
Marco Franssen
parent
dcc60a2896
commit
65d56957de
+14
-37
@@ -3,44 +3,21 @@
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPTPATH=$(dirname "$0")
|
||||
HELM_DOCS_VERSION="1.11.0"
|
||||
README_GENERATOR_VERSION="2.5.1"
|
||||
README_GENERATOR_EXE="readme-generator"
|
||||
|
||||
case "$(uname -s)" in
|
||||
Linux*)
|
||||
machine=Linux
|
||||
shasum=sha256sum
|
||||
exe=helm-docs
|
||||
;;
|
||||
Darwin*)
|
||||
machine=Darwin
|
||||
shasum=shasum
|
||||
exe=helm-docs
|
||||
;;
|
||||
MINGW64*)
|
||||
machine=Windows
|
||||
shasum=sha256sum
|
||||
exe=helm-docs.exe
|
||||
;;
|
||||
esac
|
||||
|
||||
function install_helm_docs {
|
||||
curl -LO "https://github.com/norwoodj/helm-docs/releases/download/v${HELM_DOCS_VERSION}/helm-docs_${HELM_DOCS_VERSION}_${machine}_x86_64.tar.gz"
|
||||
curl -L --output /tmp/checksums_helm-docs.txt "https://github.com/norwoodj/helm-docs/releases/download/v${HELM_DOCS_VERSION}/checksums.txt"
|
||||
grep "helm-docs_${HELM_DOCS_VERSION}_${machine}_x86_64.tar.gz" /tmp/checksums_helm-docs.txt | $shasum -c -
|
||||
mkdir -p "$SCRIPTPATH/bin"
|
||||
tar -xf "helm-docs_${HELM_DOCS_VERSION}_${machine}_x86_64.tar.gz" "${exe}"
|
||||
mv "${exe}" "$SCRIPTPATH/bin/"
|
||||
rm "helm-docs_${HELM_DOCS_VERSION}_${machine}_x86_64.tar.gz"
|
||||
}
|
||||
|
||||
if [ ! -f "$SCRIPTPATH/bin/${exe}" ] ; then
|
||||
install_helm_docs
|
||||
elif [[ ! "$("$SCRIPTPATH/bin/${exe}" --version)" =~ .*"$HELM_DOCS_VERSION".* ]] ; then
|
||||
install_helm_docs
|
||||
else
|
||||
echo "Using '$("$SCRIPTPATH/bin/${exe}" --version)'"
|
||||
if ! hash "${README_GENERATOR_EXE}" 2>/dev/null; then
|
||||
echo >&2 "readme-generator not installed. Installing..."
|
||||
hash npm 2>/dev/null || { echo >&2 "npm is required to install ${README_GENERATOR_EXE}. Please install npm and rerun the script. Aborting."; exit 1; }
|
||||
# platform agnostic npm install, also adds into the path
|
||||
npm install -g "@bitnami/readme-generator-for-helm@${README_GENERATOR_VERSION}"
|
||||
fi
|
||||
|
||||
# validate docs
|
||||
"$SCRIPTPATH/bin/${exe}" --document-dependency-values
|
||||
# generate docs and show the diff
|
||||
mapfile -t chart_paths < <(find "$SCRIPTPATH/charts" -type f -iname "Chart.yaml" -exec dirname {} +)
|
||||
for cpath in "${chart_paths[@]}"
|
||||
do
|
||||
echo >&2 "Generating Chart documentation for ${cpath}…"
|
||||
readme-generator --values="${cpath}/values.yaml" --readme="${cpath}/README.md"
|
||||
done
|
||||
git diff --exit-code
|
||||
|
||||
Reference in New Issue
Block a user