Skip to content

Commit 8dbbd51

Browse files
committed
feat(workflow): add cache charts
1 parent 8e333e0 commit 8dbbd51

3 files changed

Lines changed: 65 additions & 13 deletions

File tree

.drone/drone.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ steps:
4646
- python _scripts/dependency_update.py "$CHARTMUSEUM_API/$([ -z $DRONE_TAG ] && echo testing || echo stable)" "charts/workflow/requirements.yaml"
4747
- helm package charts/workflow -u --version ${DRONE_TAG:-v1.0.0}
4848
- curl -u $CHARTMUSEUM_USERNAME:$CHARTMUSEUM_PASSWORD -F chart=@workflow-${DRONE_TAG:-v1.0.0}.tgz "$CHARTMUSEUM_API/api/$([ -z $DRONE_TAG ] && echo testing || echo stable)/charts"
49+
- bash _scripts/generate_cache.sh
4950
environment:
5051
CHARTMUSEUM_API:
5152
from_secret: chartmuseum_api

_scripts/generate_cache.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
set -eo pipefail
3+
shopt -s expand_aliases
4+
5+
tmp=$(mktemp -d)
6+
7+
function clean_before_exit {
8+
# delay before exiting, so stdout/stderr flushes through the logging system
9+
rm -rf $tmp
10+
sleep 3
11+
}
12+
trap clean_before_exit EXIT
13+
cd $tmp
14+
15+
helm repo add cilium https://helm.cilium.io/
16+
helm repo add bitnami https://charts.bitnami.com/bitnami
17+
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
18+
helm repo add longhorn https://charts.longhorn.io
19+
helm repo add jetstack https://charts.jetstack.io
20+
helm repo add svc-cat https://kubernetes-sigs.github.io/service-catalog
21+
helm repo update
22+
23+
helm fetch cilium/cilium
24+
helm fetch bitnami/metallb
25+
helm fetch ingress-nginx/ingress-nginx
26+
helm fetch longhorn/longhorn
27+
helm fetch jetstack/cert-manager
28+
helm fetch svc-cat/catalog
29+
30+
for tar in `ls $tmp | grep .tgz`
31+
do
32+
curl -u $CHARTMUSEUM_USERNAME:$CHARTMUSEUM_PASSWORD -F chart=@$tar "$CHARTMUSEUM_API/api/$([ -z $DRONE_TAG ] && echo testing || echo stable)/charts"
33+
done

_scripts/install.sh

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,35 @@ if [[ -z "${DRYCC_ADMIN_USERNAME}" || -z "${DRYCC_ADMIN_PASSWORD}" ]] ; then
2222
exit 1
2323
fi
2424

25+
# initArch discovers the architecture for this system.
26+
initArch() {
27+
ARCH=$(uname -m)
28+
case $ARCH in
29+
armv5*) ARCH="armv5";;
30+
armv6*) ARCH="armv6";;
31+
armv7*) ARCH="arm";;
32+
aarch64) ARCH="arm64";;
33+
x86) ARCH="386";;
34+
x86_64) ARCH="amd64";;
35+
i686) ARCH="386";;
36+
i386) ARCH="386";;
37+
esac
38+
}
39+
2540
function clean_before_exit {
2641
# delay before exiting, so stdout/stderr flushes through the logging system
2742
sleep 3
2843
}
2944
trap clean_before_exit EXIT
45+
initArch
46+
47+
function get_helm {
48+
tar_name="helm-canary-linux-${ARCH}.tar.gz"
49+
curl -fsSL -o "${tar_name}" "https://get.helm.sh/${tar_name}"
50+
tar -zxvf "${tar_name}"
51+
mv "linux-${ARCH}/helm" /usr/local/bin/helm
52+
rm -rf "${tar_name}" "linux-${ARCH}"
53+
}
3054

3155
if [[ "${INSTALL_K3S_MIRROR}" == "cn" ]] ; then
3256
mkdir -p /etc/rancher/k3s
@@ -64,32 +88,26 @@ export INSTALL_K3S_EXEC
6488
install-k3s
6589
mount bpffs -t bpf /sys/fs/bpf
6690

67-
curl -sfL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash -
91+
get_helm
6892

69-
helm repo add cilium https://helm.cilium.io/
70-
helm repo add bitnami https://charts.bitnami.com/bitnami
71-
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
72-
helm repo add longhorn https://charts.longhorn.io
73-
helm repo add jetstack https://charts.jetstack.io
74-
helm repo add svc-cat https://kubernetes-sigs.github.io/service-catalog
7593
helm repo add drycc https://charts.drycc.cc/${CHANNEL:-stable}
7694
helm repo update
7795

7896
echo -e "\\033[32m---> Waiting for helm to install components...\\033[0m"
7997

80-
helm install cilium --set operator.replicas=1 cilium/cilium --namespace kube-system --wait
81-
helm install metallb bitnami/metallb --namespace kube-system --wait -f - <<EOF
98+
helm install cilium drycc/cilium --set operator.replicas=1 --namespace kube-system --wait
99+
helm install metallb drycc/metallb --namespace kube-system --wait -f - <<EOF
82100
configInline:
83101
address-pools:
84102
- name: default
85103
protocol: layer2
86104
addresses:
87105
- ${METALLB_ADDRESS_POOLS:-172.16.0.0/12}
88106
EOF
89-
helm install ingress-nginx ingress-nginx/ingress-nginx --namespace kube-system --wait
90-
helm install longhorn --create-namespace --set persistence.defaultClass=false --set persistence.defaultClassReplicaCount=1 longhorn/longhorn --namespace longhorn-system --wait
91-
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true --wait
92-
helm install catalog svc-cat/catalog --set asyncBindingOperationsEnabled=true --namespace catalog --create-namespace --wait
107+
helm install ingress-nginx drycc/ingress-nginx --namespace kube-system --wait
108+
helm install longhorn drycc/longhorn --create-namespace --set persistence.defaultClass=false --set persistence.defaultClassReplicaCount=1 --namespace longhorn-system --wait
109+
helm install cert-manager drycc/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true --wait
110+
helm install catalog drycc/catalog --set asyncBindingOperationsEnabled=true --namespace catalog --create-namespace --wait
93111

94112
echo -e "\\033[32m---> Start installing workflow...\\033[0m"
95113

0 commit comments

Comments
 (0)