-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