Installation scripts for aiml
[aiml-fw/aimlfw-dep.git] / bin / install_common_templates_to_helm.sh
1 # ==================================================================================
2 #
3 #       Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
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
19 #!/bin/bash
20
21 echo "Installing servecm (Chart Manager) and common templates to helm3"
22
23 helm plugin install https://github.com/jdolitsky/helm-servecm
24 eval $(helm env |grep HELM_REPOSITORY_CACHE) 
25 echo ${HELM_REPOSITORY_CACHE}
26
27 helm servecm --port=8879 --context-path=/charts --storage local --storage-local-rootdir $HELM_REPOSITORY_CACHE/local/ <<EOF &
28 yes
29 EOF
30
31 CURL_CMD="curl --silent --output /dev/null  http://127.0.0.1:8879/charts"
32 `${CURL_CMD}`
33 READY=$?
34 while [ ${READY} != 0 ]; do
35         echo "servecm not yet running. sleeping for 2 seconds"
36         sleep 2
37         `${CURL_CMD}`
38         READY=$?
39 done
40 echo "servcm up and running"
41
42 eval $(helm env |grep HELM_REPOSITORY_CACHE)
43 echo ${HELM_REPOSITORY_CACHE}
44 mkdir -p "${HELM_REPOSITORY_CACHE}/local/"
45
46 export COMMON_CHART_VERSION=$(cat aimlfw-common/Common-Template/helm/aimlfw-common/Chart.yaml | grep version | awk '{print $2}')
47 helm package -d /tmp aimlfw-common/Common-Template/helm/aimlfw-common
48 cp /tmp/aimlfw-common-${COMMON_CHART_VERSION}.tgz "${HELM_REPOSITORY_CACHE}/local/"
49 helm repo remove local
50 helm repo add local http://127.0.0.1:8879/charts
51
52 echo "checking that aimlfw-common templates were added"
53 helm search repo local/aimlfw-common