-
Notifications
You must be signed in to change notification settings - Fork 28
/
entrypoint.sh
41 lines (35 loc) · 1.18 KB
/
entrypoint.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
#!/bin/sh
set -e
if [ -n "${GPG_PUB_KEYS}" ]; then
for KEY in ${GPG_PUB_KEYS}; do
echo "Fetch ${KEY} from hkp://p80.pool.sks-keyservers.net:80"
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv ${KEY};
if [ $? != 0 ]; then
# Fallback if first fetch failed
echo "Fallback: Fetch ${KEY} from hkp://ipv4.pool.sks-keyservers.net"
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv ${KEY};
if [ $? != 0 ]; then
# 2nd fallback
echo "2nd fallback: Fetch ${KEY} from hkp://pgp.mit.edu:80"
gpg --keyserver hkp://pgp.mit.edu:80 --recv ${KEY};
fi
fi
done
fi
if [ -n "${REPO_YAML_URL}" ]; then
REPO_YAML_PATH="/tmp/repo-values.yaml"
curl --location --silent --show-error --output $REPO_YAML_PATH $REPO_YAML_URL
if [ -e $REPO_YAML_PATH ]; then
size=$(yq r $REPO_YAML_PATH 'sync.repos[*].name' | wc -l )
for REPO in $(seq 1 $size); do
helm repo add "$(yq r $REPO_YAML_PATH sync.repos[$REPO].name)" "$(yq r $REPO_YAML_PATH sync.repos[$REPO].url)";
done
else
echo "Download repo-values.yaml failed from URL ${REPO_YAML_URL}."
fi
fi
if [ -n "${1}" ]; then
${1}
else
sh /data/commands.sh
fi