Update fetch_helm_deps.sh

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
This commit is contained in:
Kjeld Schouten-Lebbing 2022-11-12 16:00:47 +01:00 committed by GitHub
parent a32bcf03f9
commit 07c6d1ab7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 69 additions and 59 deletions

View File

@ -19,12 +19,13 @@ trains=(
"dependency" "dependency"
) )
for train in "${trains[@]}"; do download_deps() {
for chart in $(ls "$charts_ath/$train"); do local charttrain="$1"
deps=$(go-yq '.dependencies' "$charts_ath/$train/$chart/Chart.yaml")
deps=$(go-yq '.dependencies' "$charts_ath/$charttrain/Chart.yaml")
length=$(echo "$deps" | go-yq '. | length') length=$(echo "$deps" | go-yq '. | length')
echo "🔨 Processing <$chart>... Dependencies: $length" echo "🔨 Processing <$charts_ath/$charttrain>... Dependencies: $length"
echo "" echo ""
for idx in $(eval echo "{0..$length}"); do for idx in $(eval echo "{0..$length}"); do
@ -55,7 +56,7 @@ for train in "${trains[@]}"; do
wget --quiet "$dep_url" -P "$cache_path/" wget --quiet "$dep_url" -P "$cache_path/"
if [ ! $? ]; then if [ ! $? ]; then
echo "❌ wget encountered an error..." echo "❌ wget encountered an error..."
helm dependency build "$charts_ath/$train/$chart/Chart.yaml" || helm dependency update "$charts_ath/$train/$chart/Chart.yaml" || exit 1 helm dependency build "$charts_ath/$charttrain/Chart.yaml" || helm dependency update "$charts_ath/$charttrain/Chart.yaml" || exit 1
fi fi
if [ -f "$cache_path/$name-$version.tgz" ]; then if [ -f "$cache_path/$name-$version.tgz" ]; then
@ -63,14 +64,14 @@ for train in "${trains[@]}"; do
else else
echo "❌ Failed to download dependency" echo "❌ Failed to download dependency"
# Try helm dependency build/update or otherwise fail fast if a dep fails to download... # Try helm dependency build/update or otherwise fail fast if a dep fails to download...
helm dependency build "$charts_ath/$train/$chart/Chart.yaml" || helm dependency update "$charts_ath/$train/$chart/Chart.yaml" || exit 1 helm dependency build "$charts_ath/$charttrain/Chart.yaml" || helm dependency update "$charts_ath/$charttrain/Chart.yaml" || exit 1
fi fi
fi fi
echo "" echo ""
mkdir -p "$charts_ath/$train/$chart/charts" mkdir -p "$charts_ath/$charttrain/charts"
echo "📝 Copying dependency <$name-$version.tgz> to <$charts_ath/$train/$chart/charts>..." echo "📝 Copying dependency <$name-$version.tgz> to <$charts_ath/$charttrain/charts>..."
cp "$cache_path/$name-$version.tgz" "$charts_ath/$train/$chart/charts" cp "$cache_path/$name-$version.tgz" "$charttrain/charts"
if [ -f "$cache_path/$name-$version.tgz" ]; then if [ -f "$cache_path/$name-$version.tgz" ]; then
echo "✅ Dependency copied!" echo "✅ Dependency copied!"
@ -78,10 +79,19 @@ for train in "${trains[@]}"; do
else else
echo "❌ Failed to copy dependency" echo "❌ Failed to copy dependency"
# Try helm dependency build/update or otherwise fail fast if a dep fails to copy... # Try helm dependency build/update or otherwise fail fast if a dep fails to copy...
ehelm dependency build "$charts_ath/$train/$chart/Chart.yaml" || helm dependency update "$charts_ath/$train/$chart/Chart.yaml" || exit 1 helm dependency build "$charts_ath/$charttrain/Chart.yaml" || helm dependency update "$charts_ath/$charttrain/Chart.yaml" || exit 1
fi fi
fi fi
done done
echo "----------" }
export -f download_deps
if [ -z "$1" ]; then
for train in "${trains[@]}"; do
for chart in $(ls "$charts_ath/$train"); do
download_deps "${train}/${chart}"
done done
done done
else
download_deps "$1"
done