From b5250ea8e93a66373d6543bc851dc45cb3b44bc2 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Fri, 1 Dec 2023 13:49:52 +0100 Subject: [PATCH] =?UTF-8?q?Add=20test-e2e-openshift=20and=20make=20it=20gr?= =?UTF-8?q?een=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … even if it's fake. Signed-off-by: Vincent Demeester --- Makefile | 9 ++++++ hack/install-osp.sh | 69 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100755 hack/install-osp.sh diff --git a/Makefile b/Makefile index 0a6e863..c0eaad7 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,15 @@ test-integration: test-e2e: install $(BATS_CORE) $(BATS_FLAGS) $(ARGS) $(E2E_TESTS) +# Run all the end-to-end tests against the current openshift context. +# It is used mainly by the CI and ideally shouldn't differ that much from test-e2e +.PHONY: prepare-e2e-openshift +prepare-e2e-openshift: + ./hack/install-osp.sh $(OSP_VERSION) +.PHONY: test-e2e-openshift +test-e2e-openshift: prepare-e2e-openshift +test-e2e-openshift: test-e2e + # act runs the github actions workflows, so by default only running the test workflow (integration # and end-to-end) to avoid running the release workflow accidently act: ARGS = --workflows=./.github/workflows/test.yaml diff --git a/hack/install-osp.sh b/hack/install-osp.sh new file mode 100755 index 0000000..3380238 --- /dev/null +++ b/hack/install-osp.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +# Install OpenShift Pipelines on the current cluster + +set -o errexit +set -o nounset +set -o pipefail + +readonly export DEPLOYMENT_TIMEOUT="${DEPLOYMENT_TIMEOUT:-5m}" + +function fail() { + echo "ERROR: ${*}" >&2 + exit 1 +} + +function rollout_status() { + local namespace="${1}" + local deployment="${2}" + + if ! kubectl --namespace="${namespace}" --timeout=${DEPLOYMENT_TIMEOUT} \ + rollout status deployment "${deployment}"; then + fail "'${namespace}/${deployment}' is not deployed as expected!" + fi +} + +OSP_VERSION=${1:-latest} +shift + +CHANNEL="" + +case "$OSP_VERSION" in + nightly) + echo "Not supporting nightly just yet" + # FIXME add support for it + exit 0 + ;; + latest) + CHANNEL="latest" + ;; + *) + CHANNEL="pipelines-$OSP_VERSION" + ;; +esac + +echo "Installing OpenShift Pipelines from channel ${CHANNEL}" +cat <