Run helm dependency on every chart

pull/532/head
Caleb Bron 2020-08-11 14:51:34 -07:00
parent c1ede43dc1
commit 943d41ec5b
2 changed files with 21 additions and 25 deletions

View File

@ -39,38 +39,34 @@ for f in packages/*; do
if [[ "${split_crds}" == "true" ]]; then
./scripts/prepare-crds ${f}
fi
copied_dependencies=()
if [[ -f ${f}/charts/requirements.yaml ]]; then
repos=$(cat ${f}/charts/requirements.yaml | yq r - "dependencies.*.repository")
while IFS= read -r repo; do
if [[ ${repo} == file://* ]]; then
charts_path=${repo/file:\/\//${f}/charts/}
overlay_path=${repo/file:\/\//${f}/overlay/}
if [[ ! -d $charts_path ]] && [[ -d $overlay_path ]]; then
cp -R $overlay_path $charts_path
copied_dependencies+=("${charts_path}")
fi
fi
done < <(echo "${repos}")
fi
pwd=$(pwd)
cd ${f}/charts
helm dependency update
cd $pwd
for dep in "${copied_dependencies[@]}"; do
rm -rf $dep
done
fi
fi
done
# if any sub-charts were prepared pull them in
# Loop through packages again and copy dependencies over
# If sub-charts existed as package.yaml they will now be vendored into parent
for f in packages/*; do
if [[ ! -f ${f}/package.yaml && -f ${f}/charts/requirements.yaml ]]; then
ls ${f}/charts/requirements.yaml
if [[ -z $CHART || $CHART == $(basename -- ${f}) ]]; then
copied_dependencies=()
if [[ -f ${f}/charts/requirements.yaml ]]; then
repos=$(cat ${f}/charts/requirements.yaml | yq r - "dependencies.*.repository")
while IFS= read -r repo; do
if [[ ${repo} == file://* ]]; then
charts_path=${repo/file:\/\//${f}/charts/}
overlay_path=${repo/file:\/\//${f}/overlay/}
if [[ ! -d $charts_path ]] && [[ -d $overlay_path ]]; then
cp -R $overlay_path $charts_path
copied_dependencies+=("${charts_path}")
fi
fi
done < <(echo "${repos}")
fi
pwd=$(pwd)
cd ${f}/charts
helm dependency update
cd $pwd
for dep in "${copied_dependencies[@]}"; do
rm -rf $dep
done
fi
done

View File

@ -50,7 +50,7 @@ for crd_yaml in ${f}/charts-crd/templates/*; do
crd_group=$(yq r ${crd_yaml} 'spec.group')
crd_kind=$(yq r ${crd_yaml} 'spec.names.kind')
crd_version=$(yq r ${crd_yaml} 'spec.version')
if test -z "$crd_version"; then
if [[ -z "$crd_version" ]]; then
crd_version=$(yq r ${crd_yaml} 'spec.versions[0].name')
fi
crd_apis+=("${crd_group}/${crd_version}/${crd_kind}")