Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue where index.yaml was never merged with existing one. #1

Merged
merged 1 commit into from
Nov 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions push-helm-charts.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash

set -xeuo pipefail
set -xeuo pipefail

helm init --client-only
helm init --client-only

#####
#####
# set up the repo dir, and package up all charts
#####
CHARTS_REPO=${PLUGIN_CHARTS_REPO:-"https://athens.blob.core.windows.net"}
Expand All @@ -13,38 +13,41 @@ REPO_DIR=bin/charts # This is where we do the charge merge and dirty things up,
mkdir -p $REPO_DIR
echo "entering $REPO_DIR"
cd $REPO_DIR
if curl --output /dev/null --silent --head --fail ${CHARTS_REPO}/${CHARTS_BUCKET}/index.yaml; then
if curl --output /dev/null --silent --head --fail "$CHARTS_REPO/$CHARTS_BUCKET/index.yaml"; then
echo "downloading existing index.yaml"
curl -sLO ${CHARTS_REPO}/${CHARTS_BUCKET}/index.yaml
curl -sLO "$CHARTS_REPO/$CHARTS_BUCKET/index.yaml"
fi

#####
#####
# package the charts
#####
for dir in `ls ../../charts`;do
if [ ! -f ../../charts/$dir/Chart.yaml ];then
echo "skipping $dir because it lacks a Chart.yaml file"
else
echo "packaging $dir"
helm dep build ../../charts/$dir
helm package ../../charts/$dir
fi
for dir in ../../charts/*; do
[[ -e "$dir" ]] || break # handle case of no charts
[[ -d "$dir" ]] || continue # handle case that $dir is a file

if [ ! -f "$dir/Chart.yaml" ]; then
echo "skipping $dir because it lacks a Chart.yaml file"
else
echo "packaging $dir"
helm dep build "$dir"
helm package "$dir"
fi
done

if [ -f $REPO_DIR/index.yaml ]; then
if [ -f ./index.yaml ]; then
Copy link
Contributor Author

@seeruk seeruk Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to help pick out the fix, this was it - at this point you're still in $REPO_DIR, so previously it would be looking in bin/charts/bin/charts for an index.yaml.

The rest of the file was fixing mixed indentation and remedying issues that shellcheck found with the script.

echo "merging with existing index.yaml"
helm repo index --url "$CHARTS_REPO/$CHARTS_BUCKET" --merge index.yaml .
else
echo "generating new index.yaml"
helm repo index .
fi

#####
#####
# upload to Azure blob storage
#####
if [ ! -v AZURE_STORAGE_CONNECTION_STRING ]; then
echo "AZURE_STORAGE_CONNECTION_STRING env var required to publish"
exit 1
echo "AZURE_STORAGE_CONNECTION_STRING env var required to publish"
exit 1
fi
echo "uploading from $PWD"
az storage blob upload-batch --destination $CHARTS_BUCKET --source .
az storage blob upload-batch --destination $CHARTS_BUCKET --source .