KubeZero/scripts/publish.sh

41 lines
964 B
Bash
Raw Normal View History

2020-05-01 15:33:41 +00:00
#!/bin/bash
2021-11-27 13:02:23 +00:00
set -ex
REPO_URL_S3="s3://zero-downtime-web/cdn/charts"
REPO_URL="https://cdn.zero-downtime.net/charts"
2020-05-01 15:33:41 +00:00
CHARTS=${1:-'.*'}
2020-05-01 15:33:41 +00:00
SRCROOT="$(cd "$(dirname "$0")/.." && pwd)"
2021-01-21 10:53:53 +00:00
TMPDIR=$(mktemp -d kubezero-repo.XXX)
2021-11-27 13:02:23 +00:00
mkdir -p $TMPDIR
2020-05-01 15:33:41 +00:00
2021-11-27 13:02:23 +00:00
[ -z "$DEBUG" ] && trap 'rm -rf $TMPDIR' ERR EXIT
2020-05-01 15:33:41 +00:00
for dir in $(find -L $SRCROOT/charts -mindepth 1 -maxdepth 1 -type d);
2020-05-01 15:33:41 +00:00
do
name=$(basename $dir)
[[ $name =~ $CHARTS ]] || continue
2021-11-27 13:02:23 +00:00
2020-05-01 15:33:41 +00:00
if [ $(helm dep list $dir 2>/dev/null| wc -l) -gt 1 ]
then
echo "Processing chart dependencies"
2020-07-07 12:17:20 +00:00
rm -rf $dir/tmpcharts
helm dependency update --skip-refresh $dir
2020-05-01 15:33:41 +00:00
fi
echo "Processing $dir"
2021-11-27 13:02:23 +00:00
helm lint $dir
helm package -d $TMPDIR $dir
2020-05-01 15:33:41 +00:00
done
2021-11-27 13:02:23 +00:00
curl -L -s -o $TMPDIR/index.yaml ${REPO_URL}/index.yaml
2021-08-25 14:02:21 +00:00
2021-11-27 13:02:23 +00:00
helm repo index $TMPDIR --url $REPO_URL --merge $TMPDIR/index.yaml
2020-05-01 15:33:41 +00:00
2021-11-27 13:02:23 +00:00
aws s3 cp $TMPDIR/*.tgz $REPO_URL_S3/
aws s3 cp $TMPDIR/index.yaml $REPO_URL_S3/ --cache-control max-age=1
2021-01-21 10:53:53 +00:00
rm -rf $TMPDIR