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
24 while [ -n "$1" ]; do # while loop starts
31 *) echo "Option $1 not recognized. Please use -f to specify the recipe path." ;; # In case you typed a different option other than a,b,c
39 if [ -z $OVERRIDEYAML ]; then
40 echo "Deploy recipe is missing. Please use -f to specify the recipe path."
45 ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
47 rm -rf $TEMP_DIR/imagelist
48 touch $TEMP_DIR/imagelist
50 while IFS= read -r -d $'\0'; do
51 CHART_ARRAY+=("$REPLY")
52 done < <(find $ROOT_DIR/../ -name Chart.yaml -printf '%h\0')
54 rm -fr $TEMP_DIR/ric-common*.tgz
56 helm package -d $TEMP_DIR $ROOT_DIR/../ric-common/Common-Template/helm/ric-common
57 echo "***************************************"
61 for dir in "${CHART_ARRAY[@]}"
66 echo "Analyzing Chart $(echo $dir | awk '{n=split($0, a, "/"); print a[n]}')"
69 cp $TEMP_DIR/ric-common*.tgz $dir/charts/
71 helm dep up $dir > /dev/null 2>&1
73 IMAGE_ARRAY=$(helm template -f $OVERRIDEYAML $dir | grep "image:" | awk '{ gsub(/.*image: /, "", $0); gsub(/"/, "", $0); print $0}' )
76 for f in $IMAGE_ARRAY; do
78 FOUND=$(grep $f $TEMP_DIR/imagelist)
79 if [ -z $FOUND ]; then
80 echo "Found unique docker image $f."
81 echo $f >> $TEMP_DIR/imagelist
86 echo "***************************************"
91 echo "Your image list is available here: $TEMP_DIR/imagelist"