Commit 783081ae authored by Bertrand Goareguer's avatar Bertrand Goareguer Committed by Pierre Smeyers
Browse files

Resolve "cm-push plugin installation fails with Helm 4"

parent 78733f41
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -1197,8 +1197,18 @@ stages:
        helm ${TRACE+--debug} push "$_pkg" "$HELM_PUBLISH_URL"
      else
        log_info "Installing cm-push plugin (version ${HELM_CM_PUSH_PLUGIN_VERSION:-latest})..."
        cm_push_plugin_verify_flag=""
        plugin_helm_major="$(helm version --short 2>/dev/null | sed 's/^v//' | cut -d. -f1)"
        # Helm version support EOL : https://helm.sh/el/blog/helm-4-released/#helm-v3-support
        if echo "$plugin_helm_major" | awk '/^[0-9]+$/ {exit 0} {exit 1}' && [ "$plugin_helm_major" -ge 4 ]; then
          cm_push_plugin_verify_flag="--verify=false" # Disable signature verification because cm-push is not signed (https://github.com/chartmuseum/helm-push/issues/243)
          log_info "--- helm v${plugin_helm_major} detected: plugin signature verification = \e[33;1mfalse\e[0m (--verify flag used)"
        else
          log_info "--- helm v${plugin_helm_major} detected: signature verification not supported (--verify flag ignored)"
        fi

        # shellcheck disable=SC2086
        helm ${TRACE+--debug} plugin install ${HELM_CM_PUSH_PLUGIN_VERSION:+--version "$HELM_CM_PUSH_PLUGIN_VERSION"} https://github.com/chartmuseum/helm-push || true
        helm ${TRACE+--debug} plugin install ${cm_push_plugin_verify_flag} ${HELM_CM_PUSH_PLUGIN_VERSION:+--version "$HELM_CM_PUSH_PLUGIN_VERSION"} https://github.com/chartmuseum/helm-push || true
        # shellcheck disable=SC2086
        helm ${TRACE+--debug} cm-push --username "$username" --password "$password" "$_pkg" "$HELM_PUBLISH_URL"
      fi