-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·52 lines (45 loc) · 1.48 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
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh -l
# Exit on error.
set -e;
CURRENT_DIR=$(pwd);
run_kubeval() {
# Validate all generated manifest against Kubernetes json schema
cd "$1"
VALUES_FILE="$2"
mkdir helm-output;
helm template --values "$VALUES_FILE" --output-dir helm-output .;
find helm-output -type f -exec \
/kubeval/kubeval \
"-o=$OUTPUT" \
"--strict=$STRICT" \
"--kubernetes-version=$KUBERNETES_VERSION" \
"--openshift=$OPENSHIFT" \
"--ignore-missing-schemas=$IGNORE_MISSING_SCHEMAS" \
{} +;
rm -rf helm-output;
}
# Parse helm repos located in the $CONFIG_FILE file / Ignore commented lines (#)
while read REPO_CONFIG
do
case "$REPO_CONFIG" in \#*) continue ;; esac
REPO=$(echo $REPO_CONFIG | cut -d '=' -f1);
URL=$(echo $REPO_CONFIG | cut -d '=' -f2);
helm repo add $REPO $URL;
done < $CONFIG_FILE
helm repo update
# For all charts (i.e for every directory) in the directory
for CHART in "$CHARTS_PATH"/*/; do
echo "Validating $CHART Helm Chart...";
cd "$CURRENT_DIR/$CHART";
helm dependency build --skip-refresh;
if [ -d "ci" ]; then
for VALUES_FILE in ci/*-values.yaml; do
echo "Validating $CHART Helm Chart using $VALUES_FILE values file...";
run_kubeval "$(pwd)" "$VALUES_FILE"
done
else
run_kubeval "$(pwd)" "/dev/null"
fi
echo "Cleanup $(pwd)/charts directory after we are done running Kubeval"
rm -rf $(pwd)/charts/
done