41 lines
964 B
Bash
Executable File
41 lines
964 B
Bash
Executable File
#!/bin/bash
|
|
set -ex
|
|
|
|
REPO_URL_S3="s3://zero-downtime-web/cdn/charts"
|
|
REPO_URL="https://cdn.zero-downtime.net/charts"
|
|
|
|
CHARTS=${1:-'.*'}
|
|
|
|
SRCROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
TMPDIR=$(mktemp -d kubezero-repo.XXX)
|
|
mkdir -p $TMPDIR
|
|
|
|
[ -z "$DEBUG" ] && trap 'rm -rf $TMPDIR' ERR EXIT
|
|
|
|
for dir in $(find -L $SRCROOT/charts -mindepth 1 -maxdepth 1 -type d);
|
|
do
|
|
name=$(basename $dir)
|
|
[[ $name =~ $CHARTS ]] || continue
|
|
|
|
if [ $(helm dep list $dir 2>/dev/null| wc -l) -gt 1 ]
|
|
then
|
|
echo "Processing chart dependencies"
|
|
rm -rf $dir/tmpcharts
|
|
helm dependency update --skip-refresh $dir
|
|
fi
|
|
|
|
echo "Processing $dir"
|
|
helm lint $dir
|
|
helm package -d $TMPDIR $dir
|
|
done
|
|
|
|
curl -L -s -o $TMPDIR/index.yaml ${REPO_URL}/index.yaml
|
|
|
|
helm repo index $TMPDIR --url $REPO_URL --merge $TMPDIR/index.yaml
|
|
|
|
aws s3 cp $TMPDIR/*.tgz $REPO_URL_S3/
|
|
aws s3 cp $TMPDIR/index.yaml $REPO_URL_S3/ --cache-control max-age=1
|
|
|
|
rm -rf $TMPDIR
|