rancher-partner-charts/scripts/generate-charts

38 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
for f in packages/*; do
if [[ -z $CHART || $CHART == $(basename -- ${f}) ]]; then
mkdir -p assets/$(basename -- ${f})
if [[ -d ${f}/overlay ]]; then
cp -R ${f}/overlay/* ${f}/charts
fi
version=""
if [[ -f ${f}/package.yaml ]]; then
version=$(yq r ${f}/charts/Chart.yaml version)
packageVersion=$(yq r ${f}/package.yaml packageVersion)
yq w -i ${f}/charts/Chart.yaml 'version' "${version}${packageVersion}"
fi
helm package ${f}/charts --destination assets/$(basename -- ${f})
# copy over contents to charts/ folder for browsing purpose
mkdir -p charts/$(basename -- ${f})
cp -R ${f}/charts/* charts/$(basename -- ${f})/
if [[ -d ${f}/charts-crd ]]; then
packageVersion=$(yq r ${f}/package.yaml packageVersion)
yq w -i ${f}/charts-crd/Chart.yaml 'version' "${version}${packageVersion}"
helm package ${f}/charts-crd --destination assets/$(basename -- ${f})
# copy over contents to charts/ folder for browsing purpose
mkdir -p charts/$(basename -- ${f})/charts-crd
cp -R ${f}/charts-crd/* charts/$(basename -- ${f})/charts-crd
fi
helm repo index --merge ./assets/index.yaml --url assets assets
fi
done
cp ./assets/index.yaml .