forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync-helm-charts.sh
More file actions
executable file
·57 lines (43 loc) · 1.52 KB
/
sync-helm-charts.sh
File metadata and controls
executable file
·57 lines (43 loc) · 1.52 KB
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
54
55
56
57
#!/usr/bin/env bash
# Script to sync local charts to remote helm repository in Google Cloud Storage
# Copied from: https://github.com/helm/charts/blob/master/test/repo-sync.sh
set -o errexit
set -o nounset
set -o pipefail
log_error() {
printf '\e[31mERROR: %s\n\e[39m' "$1" >&2
}
# Assume working directory is Feast repository root folder
repo_dir=infra/charts
bucket=gs://feast-charts
repo_url=https://feast-charts.storage.googleapis.com/
sync_dir=/tmp/syncdir
index_dir=/tmp/indexdir
rm -rf $sync_dir $index_dir
echo "Syncing repo '$repo_dir'..."
mkdir -p "$sync_dir"
if ! gsutil cp "$bucket/index.yaml" "$index_dir/index.yaml"; then
log_error "Exiting because unable to copy index locally. Not safe to proceed."
exit 1
fi
exit_code=0
for dir in "$repo_dir"/*; do
if helm dep update "$dir" && helm dep build "$dir"; then
helm package --destination "$sync_dir" "$dir"
else
log_error "Problem building dependencies. Skipping packaging of '$dir'."
exit_code=1
fi
done
if helm repo index --url "$repo_url" --merge "$index_dir/index.yaml" "$sync_dir"; then
# Move updated index.yaml to sync folder so we don't push the old one again
mv -f "$sync_dir/index.yaml" "$index_dir/index.yaml"
gsutil -m rsync "$sync_dir" "$bucket"
# Make sure index.yaml is synced last
gsutil -h "Cache-Control:no-cache,max-age=0" cp "$index_dir/index.yaml" "$bucket"
else
log_error "Exiting because unable to update index. Not safe to push update."
exit 1
fi
ls -l "$sync_dir"
exit "$exit_code"