Skip to content

Commit 0363b68

Browse files
committed
Lint charts with kubeconform as extra measure
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent d5511b3 commit 0363b68

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

.github/workflows/helm.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
- uses: alexellis/arkade-get@master
3838
with:
3939
kubeval: latest
40+
kubeconform: latset
4041
# - uses: lra/setup-kubeval@v1
4142
# with:
4243
# version: v0.16.1

contrib/lint_chart.sh

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,37 @@ for chart in $ROOT/chart/*; do
1515
done
1616

1717
if [ $status != 0 ]; then
18-
echo -e "Failures:\n$msg"
18+
echo -e "Helm lint failures:\n$msg"
19+
exit $status
1920
fi
2021

21-
exit $status
22+
23+
# Run kubeconform on all charts as an extra measure
24+
25+
for chart in $ROOT/chart/*; do
26+
name=$(basename $chart)
27+
echo -e "\n\nKubeconform $name"
28+
# Use ignore-missing-schemas to avoid errors with missing CRD schemas for the openfaas chart only
29+
30+
echo "Using kubeconform on $name - $chart"
31+
32+
if [ "$name" == "openfaas" ]; then
33+
helm template chart/$name -f ./chart/openfaas/values-pro.yaml | kubeconform --ignore-missing-schemas -summary --verbose --strict
34+
else
35+
helm template chart/$name | kubeconform -summary --verbose --strict
36+
fi
37+
38+
if [ $? != 0 ]; then
39+
status=1
40+
msg="$msg\n$name"
41+
fi
42+
done
43+
44+
if [ $status != 0 ]; then
45+
echo -e "Kubeconform failures:\n$msg"
46+
exit $status
47+
fi
48+
49+
echo -e "\n\nAll charts passed linting and kubeconform validation"
50+
exit 0
51+

0 commit comments

Comments
 (0)