-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.sh
executable file
·83 lines (66 loc) · 2.42 KB
/
test.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
set -e
# This is a simplified "end to end" test script that installs all Plone helm charts
# in a local K8S cluster. Please make sure this script runs without errors before
# doing merging changes (this validation may be done automatically using the Github
# Actions).
#
# Using helm to install Plone assumes you have a running K8S cluster and a properly
# configures kubectl client. If you want to install a simplificed K8S cluster for
# development purposes, we suggest the usage of K3D (a thin wrapper around K3S project).
# Instalation instructions are available on https://k3d.io
# On Linux systems, you can use the following command:
# curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
for cmd in kubectl helm; {
if ! command -v $cmd &> /dev/null
then
echo "$cmd not found"
exit 1
fi
}
# OPTIONAL: as part of the 'end to end' testing, you can install the
# *k8s-diagrams* tool in your $PATH to enable the automatic generation
# of svg images showing all the different components installed and
# the relationship between them.
# https://github.com/trois-six/k8s-diagrams/releases/tag/v0.0.6
generate_k8s_images="${K8S_IMAGES:-false}"
if ! command -v k8s-diagrams -h &> /dev/null
then
generate_k8s_images=false
fi
# Also, to convert the dot files generated by k8s-diagrams into png/svg
# images, it is required to install the graphviz package.
if ! command -v dot -V &> /dev/null
then
generate_k8s_images=false
fi
function finish {
kubectl delete namespace plone-helm
}
trap finish EXIT
kubectl create namespace plone-helm
for helm_name in $(cat all-charts.txt | xargs); {
echo Testing $helm_name
helm dependency update ./$helm_name
helm dependency list ./$helm_name
helm lint ./$helm_name
helm install -n plone-helm myplone ./$helm_name
sleep 5
if [ "$generate_k8s_images" = true ]; then
dotdir="$(pwd)/$helm_name/diagrams"
svgdir="$(pwd)/img"
# wait more time, k8s deployment time may vary
sleep 300
rm -rf $dotdir
k8s-diagrams --namespace plone-helm \
--outputDirectory $dotdir \
--label "helm $helm_name"
mkdir -p $svgdir
cd $dotdir
dot -Tpng k8s.dot > $helm_name.png
dot -Tsvg k8s.dot > $helm_name.svg
cp -prf $helm_name.png $helm_name.svg assets $svgdir
cd -
fi
helm uninstall -n plone-helm myplone
}