-
Notifications
You must be signed in to change notification settings - Fork 3
/
push-helm-charts.sh
executable file
·53 lines (46 loc) · 1.45 KB
/
push-helm-charts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
set -xeuo pipefail
helm init --client-only --stable-repo-url https://charts.helm.sh/stable
#####
# set up the repo dir, and package up all charts
#####
CHARTS_REPO=${PLUGIN_CHARTS_REPO:-"https://athens.blob.core.windows.net"}
CHARTS_BUCKET=charts
REPO_DIR=bin/charts # This is where we do the charge merge and dirty things up, not the source chart directory
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
echo "downloading existing index.yaml"
curl -sLO "$CHARTS_REPO/$CHARTS_BUCKET/index.yaml"
fi
#####
# package the charts
#####
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 ./index.yaml ]; then
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
fi
echo "uploading from $PWD"
az storage blob upload-batch --destination $CHARTS_BUCKET --source .