F release images
[ric-plt/ric-dep.git] / bin / install_common_templates_to_helm.sh
1 #!/bin/bash
2 ################################################################################
3 #   Copyright (c) 2022 Nokia.                                                  #
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
18 echo "Installing servecm (Chart Manager) and common templates to helm3"
19
20 helm plugin install https://github.com/jdolitsky/helm-servecm
21 eval $(helm env |grep HELM_REPOSITORY_CACHE) 
22 echo ${HELM_REPOSITORY_CACHE}
23
24 nohup helm servecm --port=8879 --context-path=/charts --storage local --storage-local-rootdir $HELM_REPOSITORY_CACHE/local/ <<EOF &
25 yes
26 EOF
27
28 echo "sleeping for 5 seconds"
29 sleep 5
30
31 echo "checking that servecm is working with this curl command"
32 curl --silent --output /dev/null  http://127.0.0.1:8879/charts
33 echo "success="$?
34
35 eval $(helm env |grep HELM_REPOSITORY_CACHE)
36 echo ${HELM_REPOSITORY_CACHE}
37 mkdir -p "${HELM_REPOSITORY_CACHE}/local/"
38
39 export COMMON_CHART_VERSION=$(cat ../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}')
40 helm package -d /tmp ../ric-common/Common-Template/helm/ric-common
41 cp /tmp/ric-common-${COMMON_CHART_VERSION}.tgz "${HELM_REPOSITORY_CACHE}/local/"
42 helm repo remove local
43 helm repo add local http://127.0.0.1:8879/charts
44
45 echo "checking that ric-common templates were added"
46 helm search repo local/ric-common
47
48
49