Skip to content

Commit f5eda87

Browse files
committed
Install kuttl locally via the Makefile
1 parent 37a029b commit f5eda87

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

.github/workflows/e2e.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ jobs:
4747
with:
4848
go-version: "~1.21.3"
4949

50-
- name: "install kuttl"
51-
run: ./hack/install-kuttl.sh
52-
5350
- name: "run tests"
5451
env:
5552
KUBE_VERSION: ${{ matrix.kube-version }}

Makefile

+3-16
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ cmctl:
356356

357357
KUSTOMIZE ?= $(LOCALBIN)/kustomize
358358
KIND ?= $(LOCALBIN)/kind
359+
KUTTL ?= $(LOCALBIN)/kubectl-kuttl
359360
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
360361
ENVTEST ?= $(LOCALBIN)/setup-envtest
361362
CHLOGGEN ?= $(LOCALBIN)/chloggen
@@ -365,6 +366,7 @@ KUSTOMIZE_VERSION ?= v5.0.3
365366
CONTROLLER_TOOLS_VERSION ?= v0.12.0
366367
GOLANGCI_LINT_VERSION ?= v1.54.0
367368
KIND_VERSION ?= v0.20.0
369+
KUTTL_VERSION ?= 0.15.0
368370

369371

370372
.PHONY: kustomize
@@ -411,22 +413,7 @@ endef
411413

412414
.PHONY: kuttl
413415
kuttl:
414-
ifeq (, $(shell which kubectl-kuttl))
415-
echo ${PATH}
416-
ls -l /usr/local/bin
417-
which kubectl-kuttl
418-
419-
@{ \
420-
set -e ;\
421-
echo "" ;\
422-
echo "ERROR: kuttl not found." ;\
423-
echo "Please check https://kuttl.dev/docs/cli.html for installation instructions and try again." ;\
424-
echo "" ;\
425-
exit 1 ;\
426-
}
427-
else
428-
KUTTL=$(shell which kubectl-kuttl)
429-
endif
416+
@KUTTL=$(KUTTL) KUTTL_VERSION=$(KUTTL_VERSION) ./hack/install-kuttl.sh
430417

431418
OPERATOR_SDK = $(shell pwd)/bin/operator-sdk
432419
.PHONY: operator-sdk

hack/install-kuttl.sh

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#!/bin/bash
22

3-
sudo curl -Lo /usr/local/bin/kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v0.15.0/kubectl-kuttl_0.15.0_linux_x86_64
4-
sudo chmod +x /usr/local/bin/kubectl-kuttl
5-
export PATH=$PATH:/usr/local/bin
3+
if (${KUTTL} version | grep ${KUTTL_VERSION}) > /dev/null 2>&1; then
4+
exit 0;
5+
fi
6+
7+
OS=$(go env GOOS)
8+
ARCH=$(uname -m)
9+
10+
curl -Lo ${KUTTL} https://github.com/kudobuilder/kuttl/releases/download/v${KUTTL_VERSION}/kubectl-kuttl_${KUTTL_VERSION}_${OS}_${ARCH}
11+
chmod +x ${KUTTL}
12+

0 commit comments

Comments
 (0)