blob: 0fe48c0a9f78934dee656434a2d7448d30b360ed [file] [log] [blame]
Zack Williams1e107832018-05-14 14:54:25 -07001#!/usr/bin/env bash
Zack Williams9963fe52018-04-03 08:40:26 -07002
3# Copyright 2018-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# helmlint.sh
18# run `helm lint` on all helm charts that are found
19
20set +e
21echo "helmlint.sh, using helm version: $(helm version -c --short)"
22
23fail_lint=0
24
25for chart in $(find . -name Chart.yaml -print) ; do
26
27 chartdir=$(dirname "${chart}")
28
Zack Williams1e107832018-05-14 14:54:25 -070029 # update requirements if it exists. Skip voltha as it has non-clean reqirements
30 if [ "${chartdir}" != "./voltha" ] && [ -f "${chartdir}/requirements.yaml" ]; then
31 helm dependency update "${chartdir}"
32 fi
33
Zack Williams9963fe52018-04-03 08:40:26 -070034 # lint with values.yaml if it exists
35 if [ -f "${chartdir}/values.yaml" ]; then
36 helm lint --strict --values "${chartdir}/values.yaml" "${chartdir}"
37 else
38 helm lint --strict "${chartdir}"
39 fi
40
41 rc=$?
42 if [[ $rc != 0 ]]; then
43 fail_lint=1
44 fi
45done
46
47if [[ $fail_lint != 0 ]]; then
48 exit 1
49fi
50
51exit 0