Skip to content

Commit 450fdf6

Browse files
committed
WIP: Add helm version check
Until we can get helm to install via bingo, we'll have to rely on a local install of helm, so have a minimum version check. Signed-off-by: Todd Short <[email protected]>
1 parent 75917de commit 450fdf6

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ manifests: $(CONTROLLER_GEN) $(KUSTOMIZE) #EXHELP Generate WebhookConfiguration,
163163
./hack/tools/patch-base-for-helm.sh
164164
# Generate manifests stored in source-control
165165
mkdir -p $(MANIFEST_HOME)
166+
hack/tools/helm-version-check.sh
166167
helm template olmv1 helm/olmv1 > $(STANDARD_MANIFEST)
167168
helm template olmv1 helm/olmv1 --values helm/e2e.yaml > $(STANDARD_E2E_MANIFEST)
168169
helm template olmv1 helm/olmv1 --values helm/experimental.yaml > $(EXPERIMENTAL_MANIFEST)

hack/tools/helm-version-check.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
HELM=$(command -v helm)
4+
if [ -z "${HELM}" ]; then
5+
echo "helm command not found"
6+
exit 1
7+
fi
8+
9+
WANT_VER_MAJOR=3
10+
WANT_VER_MINOR=18
11+
12+
LONG_VER=$(${HELM} version | sed -E 's/.*Version:"([0-9]*\.[0-9]*\.[0-9]*)".*/\1/')
13+
14+
OLDIFS="${IFS}"
15+
IFS='.' HELM_VER=(${LONG_VER})
16+
IFS="${OLDIFS}"
17+
18+
if [ ${#HELM_VER[*]} -ne 3 ]; then
19+
echo "Invalid helm version: ${HELM_VER}"
20+
exit 1
21+
fi
22+
23+
HELM_MAJOR=${HELM_VER[0]}
24+
HELM_MINOR=${HELM_VER[1]}
25+
26+
if [ "${HELM_MAJOR}" -ne "${WANT_VER_MAJOR}" ]; then
27+
echo "Expecting helm version ${WANT_VER_MAJOR}.x, found ${LONG_VER}"
28+
exit 1
29+
fi
30+
31+
if [ "${HELM_MINOR}" -lt "${WANT_VER_MINOR}" ]; then
32+
echo "Expecting helm minimum version ${WANT_VER_MAJOR}.${WANT_VER_MINOR}.x, found ${LONG_VER}"
33+
exit 1
34+
fi

0 commit comments

Comments
 (0)