2 ##############################################################################
4 # Copyright (c) 2019 AT&T Intellectual Property.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 ##############################################################################
20 # Installs well-known RIC charts then verifies specified helm chart
21 # Requires chart tgz archives in /tmp
25 ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
28 HELMVERSION=${HELMVER:=2.12.3}
29 if [ ! -e helm-v${HELMVERSION}-linux-amd64.tar.gz ]; then
30 wget https://storage.googleapis.com/kubernetes-helm/helm-v${HELMVERSION}-linux-amd64.tar.gz
33 tar -xvf ./helm-v${HELMVERSION}-linux-amd64.tar.gz
34 mv linux-amd64/helm ./
36 # set up ric common template
37 ./setup-ric-common-template
42 # Create array of helm charts
44 while IFS= read -r -d $'\0'; do
45 CHART_ARRAY+=("$REPLY")
46 done < <(find $ROOT_DIR/../ -maxdepth 4 -name Chart.yaml -printf '%h\0')
48 echo "***************************************"
51 for dir in "${CHART_ARRAY[@]}"
54 echo "Update chart depenedency"
56 # Lint clearly marks errors; e.g., [ERROR]
57 if [ -z $OVERRIDEYAML ]; then
58 ./helm lint $dir > /tmp/output 2>&1
60 ./helm lint -f $OVERRIDEYAML $dir> /tmp/output 2>&1
62 echo "***************************************************************************************************************"
65 egrep -q '^Error: [0-9]* chart\(s\) linted, [0-9]* chart\(s\) failed' /tmp/output && exit 1
66 echo "***************************************************************************************************************"
68 if [ -z $OVERRIDEYAML ]; then
69 ./helm template $dir > /tmp/output 2>&1
71 ./helm template -f $OVERRIDEYAML $dir > /tmp/output 2>&1
73 echo "***************************************************************************************************************"
76 egrep -n '%!.\(.*=.*\)' /tmp/output && echo "Error: Type mismatch." && exit 1
77 echo "***************************************************************************************************************"
80 #Error: 1 chart(s) linted, 1 chart(s) failed