From: saul.gill Date: Wed, 11 Feb 2026 12:54:48 +0000 (+0000) Subject: Update cm push plugin X-Git-Tag: 2026.02.20~12 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=79d37c08c2e2f2fd2ff707095f7a6e209be2b1c9;p=it%2Fdep.git Update cm push plugin Add logic to install the correct plugin version Make compatible with helm 3 and 4 Issue-ID: NONRTRIC-1100 Change-Id: Iba2c6a31c625d101f772d687f5c4b5400b969f62 Signed-off-by: saul.gill --- diff --git a/smo-install/scripts/layer-0/0-setup-helm3.sh b/smo-install/scripts/layer-0/0-setup-helm3.sh index 5932be90..b74a65eb 100755 --- a/smo-install/scripts/layer-0/0-setup-helm3.sh +++ b/smo-install/scripts/layer-0/0-setup-helm3.sh @@ -30,14 +30,7 @@ SCRIPT_PATH=$(dirname "$SCRIPT") # Check whether helm is installed and if not install it if command -v helm > /dev/null 2>&1; then HELM_VERSION=$(helm version --template='{{.Version}}') - if [[ $HELM_VERSION == v4* ]]; then - echo -e "\033[43;31mWARNING: Helm v4 detected ($HELM_VERSION) \033[0m" - echo -e "\033[43;31mWARNING: Helm v4 is not fully supported yet as there could be some issues with helm cm-push plugin. \033[0m" - echo -e "\033[43;31mWARNING: It is better to stick with Helm v3 for now. \033[0m" - echo -e "\033[43;31mWARNING: Consider downgrading to Helm v3 if you encounter issues. \033[0m" - else - echo "Helm is already installed. Skipping installation." - fi + echo "Helm ($HELM_VERSION) is already installed. Skipping installation." else echo "Helm is not installed. Installing helm ..." cd /tmp @@ -58,17 +51,29 @@ else fi # Check whether helm-push is installed and if not install it +# To be compatible with helm 3 and 4 cm push needs to be +# at least in version 0.11.1 +SET_VERSION=0.11.1 if helm plugin list | awk '{print $1}' | grep -w -q "cm-push"; then - echo "Helm cm-push plugin is already installed. Skipping installation." -else - echo "Helm cm-push plugin is not installed. Installing cm-push ..." - TAR_VERSION=v0.10.3 - echo "Downloading and installing helm-push ${TAR_VERSION} ..." - TAR_FILE=helm-push-${TAR_VERSION}.tar.gz + CURRENT_VERSION=$(helm plugin list | grep cm-push | awk '{print $2}') + if [[ $(printf '%s\n' "$CURRENT_VERSION" "$SET_VERSION" | sort -V | head -n1) != "$SET_VERSION" ]]; then + echo "Helm cm-push plugin version $CURRENT_VERSION is outdated. Uninstalling..." + helm plugin remove cm-push + else + echo "Helm cm-push plugin version $CURRENT_VERSION is already installed. Skipping installation." + SET_VERSION="" + fi +fi + +if [[ -n "$SET_VERSION" ]]; then + echo "Installing helm cm-push plugin version $SET_VERSION..." + TAR_FILE=helm-push_${SET_VERSION}_darwin_amd64.tar.gz HELM_PLUGINS=$(helm env HELM_PLUGINS) mkdir -p $HELM_PLUGINS/helm-push cd $HELM_PLUGINS/helm-push - wget https://nexus.o-ran-sc.org/content/repositories/thirdparty/chartmuseum/helm-push/$TAR_VERSION/$TAR_FILE + # It would be better to do this download through nexus. Sometimes, we can find that + # wget and curl fail when pulling from github + wget https://github.com/chartmuseum/helm-push/releases/download/v$SET_VERSION/$TAR_FILE tar zxvf $TAR_FILE >/dev/null rm $TAR_FILE fi