Zack Williams | 9963fe5 | 2018-04-03 08:40:26 -0700 | [diff] [blame] | 1 | #/usr/bin/env bash |
| 2 | |
| 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 | |
| 20 | set +e |
| 21 | echo "helmlint.sh, using helm version: $(helm version -c --short)" |
| 22 | |
| 23 | fail_lint=0 |
| 24 | |
| 25 | for chart in $(find . -name Chart.yaml -print) ; do |
| 26 | |
| 27 | chartdir=$(dirname "${chart}") |
| 28 | |
| 29 | # lint with values.yaml if it exists |
| 30 | if [ -f "${chartdir}/values.yaml" ]; then |
| 31 | helm lint --strict --values "${chartdir}/values.yaml" "${chartdir}" |
| 32 | else |
| 33 | helm lint --strict "${chartdir}" |
| 34 | fi |
| 35 | |
| 36 | rc=$? |
| 37 | if [[ $rc != 0 ]]; then |
| 38 | fail_lint=1 |
| 39 | fi |
| 40 | done |
| 41 | |
| 42 | if [[ $fail_lint != 0 ]]; then |
| 43 | exit 1 |
| 44 | fi |
| 45 | |
| 46 | exit 0 |