diff --git a/.tekton/frontend-operator-pull-request.yaml b/.tekton/frontend-operator-pull-request.yaml index 7f87e6a1..e838f222 100644 --- a/.tekton/frontend-operator-pull-request.yaml +++ b/.tekton/frontend-operator-pull-request.yaml @@ -225,6 +225,49 @@ spec: cd ${FEO_PATH} make test + - name: run-kuttl-tests + description: run kuttl tests + params: + - name: SNAPSHOT + value: $(params.SNAPSHOT) + - name: NAMESPACE + value: $(params.NAMESPACE) + - name: EXPECTED_OUTPUT + value: $(params.EXPECTED_OUTPUT) + runAfter: + - clone-repository + workspaces: + - name: output + workspace: workspace + - name: basic-auth + workspace: git-auth + taskSpec: + params: + - name: SNAPSHOT + - name: NAMESPACE + - name: EXPECTED_OUTPUT + results: + - name: TEST_OUTPUT + description: Test output + steps: + - image: quay.io/mknop_console_dot/konflux-go-kubectl:latest + env: + - name: SNAPSHOT + value: $(params.SNAPSHOT) + - name: NAMESPACE + value: $(params.NAMESPACE) + - name: EXPECTED_OUTPUT + value: $(params.EXPECTED_OUTPUT) + - name: GOFLAGS + value: -buildvcs=false + script: | + #!/bin/bash + set -ex + + FEO_PATH="/workspace/output/source" + + cd ${FEO_PATH} + make kuttl - name: prefetch-dependencies params: - name: input diff --git a/Makefile b/Makefile index 7e52dff3..ff52940c 100644 --- a/Makefile +++ b/Makefile @@ -116,6 +116,22 @@ junit: gotestsum manifests envtest generate fmt vet # entry point for testing kuttl with kind kuttl: manifests envtest generate fmt vet + # Install krew for kubectl + set -x; cd "$(mktemp -d)" && \ + OS="$(uname | tr '[:upper:]' '[:lower:]')" && \ + ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" && \ + KREW="krew-${OS}_${ARCH}" && \ + curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" && \ + tar zxvf "${KREW}.tar.gz" && \ + ./"${KREW}" install krew + + export PATH="${KREW_ROOT:-${HOME}/.krew}/bin:${PATH}" + export PATH="/bins:${PATH}" + export PATH="/.local/bin:${PATH}" + + # Install kuttl with krew + kubectl krew install kuttl + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" kubectl kuttl test --config kuttl-config.yml ./tests/e2e ##@ Build @@ -166,7 +182,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi CONTROLLER_GEN = $(shell pwd)/testbin/bin/controller-gen controller-gen: ## Download controller-gen locally if necessary. - $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0) + $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0) KUSTOMIZE = $(shell pwd)/testbin/bin/kustomize kustomize: ## Download kustomize locally if necessary. diff --git a/kuttl_test.sh b/kuttl_test.sh index 63cb5f0b..b988b8d2 100755 --- a/kuttl_test.sh +++ b/kuttl_test.sh @@ -12,6 +12,7 @@ set -exv tar zxvf "${KREW}.tar.gz" && ./"${KREW}" install krew ) + export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" export PATH="/bins:$PATH"