X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=bin%2Fverify-ric-charts;fp=bin%2Fverify-ric-charts;h=5931548d6578878939c7dd467195334911b68d20;hb=5b91760965953d3f08cede0d61f638b54c7397b8;hp=fdeda1bf8d80c3b366090ece14d3a70fbc32b15e;hpb=b6a7c14c6064aec767785c347a1e5a348329ac67;p=ric-plt%2Fric-dep.git diff --git a/bin/verify-ric-charts b/bin/verify-ric-charts index fdeda1b..5931548 100755 --- a/bin/verify-ric-charts +++ b/bin/verify-ric-charts @@ -2,6 +2,7 @@ ############################################################################## # # Copyright (c) 2019 AT&T Intellectual Property. +# Copyright (c) 2022 Samsung Electronics Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,7 +29,7 @@ echo "--> verify-ric-charts" if [[ "${1:-nope}" != "nope" ]]; then HELMVERSION=$1 else - HELMVERSION=2.17.0 + HELMVERSION=3.9.0 fi if [[ "${2:-nope}" != "nope" ]]; then OVERRIDEYAML=$2 @@ -36,6 +37,8 @@ fi ROOT_DIR="$(pwd)" HELM_COMMAND=helm +CHARTMUSEUM_COMMAND=chartmuseum +CHARTMUSEUM_VERSION=0.14.0 if ! $($HELM_COMMAND > /dev/null);then echo "Download and install Helm" @@ -45,30 +48,54 @@ if ! $($HELM_COMMAND > /dev/null);then tar -xvf ./helm-v${HELMVERSION}-linux-amd64.tar.gz mv linux-amd64/helm ./ HELM_COMMAND=./helm - $HELM_COMMAND init -c fi + # Set up ric common template # Download it/dep common template charts git clone --single-branch --branch master "https://gerrit.o-ran-sc.org/r/it/dep" ./dep # Start Helm local repo if there isn't one -if [ ! -z $(pgrep "$HELM_COMMAND") ]; then - echo "Stopping existing local Helm server." - kill -9 "$(pgrep "$HELM_COMMAND")" +# In Helm3, running local repo requires chartmuseum and helm-servecm plugin +if ! $($CHARTMUSEUM_COMMAND > /dev/null);then + echo "Download and install chartmuseum" + wget -nv https://get.helm.sh/chartmuseum-v${CHARTMUSEUM_VERSION}-linux-amd64.tar.gz + tar -xvf ./chartmuseum-v${CHARTMUSEUM_VERSION}-linux-amd64.tar.gz + mv linux-amd64/chartmuseum ./ + CHARTMUSEUM_COMMAND=./chartmuseum + + curl https://raw.githubusercontent.com/helm/chartmuseum/main/scripts/get-chartmuseum | bash + $HELM_COMMAND plugin install https://github.com/jdolitsky/helm-servecm fi -if [ ! -d ./charts ]; then - mkdir ./charts + +if [ ! -z $(pgrep servecm) ]; then + echo "Stopping existing local Helm server." + kill -9 "$(pgrep servecm)" fi + +echo "Wait for installing servecm plugin" +timeout=10 +while [ "$timeout" -gt 0 ]; do + if $HELM_COMMAND servecm --help | grep "ChartMuseum"; then + break + fi + sleep 1s + ((timeout--)) +done + +rm -rf ./local-repo +mkdir ./local-repo + echo "Starting local Helm server" -nohup $HELM_COMMAND serve --repo-path charts >& /dev/null & +$HELM_COMMAND servecm --port=8879 --storage local --storage-local-rootdir ./local-repo --context-path=/charts & + # Package ric-common and serve it using Helm local repo -$HELM_COMMAND package --save=false -d ./charts "$ROOT_DIR/dep/ric-common/Common-Template/helm/ric-common" -$HELM_COMMAND package --save=false -d ./charts "$ROOT_DIR/dep/ric-common/Common-Template/helm/aux-common" -$HELM_COMMAND repo index ./charts +$HELM_COMMAND package --destination ./local-repo "$ROOT_DIR/dep/ric-common/Common-Template/helm/ric-common" +$HELM_COMMAND package --destination ./local-repo "$ROOT_DIR/dep/ric-common/Common-Template/helm/aux-common" + # Make sure that helm local repo is added -$HELM_COMMAND repo remove local -$HELM_COMMAND repo remove stable +$HELM_COMMAND repo index ./local-repo $HELM_COMMAND repo add local http://127.0.0.1:8879/charts + # Remove it/dep charts rm -rf ./dep