2 ################################################################################
3 # Copyright (c) 2022 Nokia. #
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 #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
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 ################################################################################
18 echo "Installing servecm (Chart Manager) and common templates to helm3"
20 helm plugin install https://github.com/jdolitsky/helm-servecm
21 eval $(helm env |grep HELM_REPOSITORY_CACHE)
22 echo ${HELM_REPOSITORY_CACHE}
24 # servecm can download chartmuseum binary, but the hardcoded location does not work anymore
25 # so, we download it now before starting servecm, so that it's available when servecm
26 # tries to start the chartmuseum binary
27 curl -LO https://get.helm.sh/chartmuseum-v0.15.0-linux-386.tar.gz
28 tar xzvf chartmuseum-v0.15.0-linux-386.tar.gz
29 chmod +x ./linux-386/chartmuseum
30 cp ./linux-386/chartmuseum /usr/local/bin
32 nohup helm servecm --port=8879 --context-path=/charts --storage local --storage-local-rootdir $HELM_REPOSITORY_CACHE/local/ <<EOF &
36 CURL_CMD="curl --silent --output /dev/null http://127.0.0.1:8879/charts"
39 while [ ${READY} != 0 ]; do
40 echo "servecm not yet running. sleeping for 2 seconds"
45 echo "servcm up and running"
47 eval $(helm env |grep HELM_REPOSITORY_CACHE)
48 echo ${HELM_REPOSITORY_CACHE}
49 mkdir -p "${HELM_REPOSITORY_CACHE}/local/"
51 export COMMON_CHART_VERSION=$(cat ../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}')
52 helm package -d /tmp ../ric-common/Common-Template/helm/ric-common
53 cp /tmp/ric-common-${COMMON_CHART_VERSION}.tgz "${HELM_REPOSITORY_CACHE}/local/"
54 helm repo remove local
55 helm repo add local http://127.0.0.1:8879/charts
57 echo "checking that ric-common templates were added"
58 helm search repo local/ric-common