From: Krzysztof Opasiak Date: Thu, 18 Feb 2021 18:09:00 +0000 (+0100) Subject: [GENERAL] Fix setting of HELM_VER variable X-Git-Tag: 8.0.0~103^2~1 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=oom.git;a=commitdiff_plain;h=refs%2Fchanges%2F76%2F118076%2F1 [GENERAL] Fix setting of HELM_VER variable It turns out that helm v2 and helm v3 uses different format for the helm version command. If we use v3 version HELM_VER variable is empty when run on a system with helm v2. To fix this let's add a fallback and if we failed to obtain correct version information using v3 format then fallback to v2 one. Issue-ID: OOM-1 Signed-off-by: Krzysztof Opasiak Change-Id: I87757c9eadedfe197ec31f5c2814fa9eb894329a --- diff --git a/kubernetes/Makefile b/kubernetes/Makefile index 3c5254ca27..ef913e33a9 100644 --- a/kubernetes/Makefile +++ b/kubernetes/Makefile @@ -20,7 +20,14 @@ OUTPUT_DIR := $(ROOT_DIR)/dist PACKAGE_DIR := $(OUTPUT_DIR)/packages SECRET_DIR := $(OUTPUT_DIR)/secrets HELM_BIN := helm -HELM_VER := $(shell $(HELM_BIN) version --template "{{.Version}}") + +# Helm v2 and helm v3 uses different version format so we first try in helm v3 format +# and if it fails then we fallback to helm v2 one +HELM_VER := $(shell $(HELM_BIN) version --template "{{.Version}}" 2>/dev/null) +ifneq "$(findstring v3,$(HELM_VER))" "v3" + HELM_VER := $(shell $(HELM_BIN) version -c --template "{{.Client.SemVer}}") +endif + # use this if you would like to push onap charts to repo with other name # WARNING: Helm v3+ only # WARNING: Make sure to edit also requirements files