From 2e785811e97d4db15bc652c0d91cff0a3e645745 Mon Sep 17 00:00:00 2001 From: David Zager Date: Tue, 14 Nov 2023 14:33:31 -0500 Subject: [PATCH] :seedling: add konveyor/ci tests for pr checks Signed-off-by: David Zager --- .github/workflows/pr-checks.yml | 22 +++++------------ hack/install-konveyor.sh | 42 +++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 16c6523f..eb136229 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -6,9 +6,6 @@ on: - main - 'release-*.*' -env: - IMG: ttl.sh/konveyor-operator-${{ github.sha }}:1h - BUNDLE_IMG: ttl.sh/konveyor-operator-bundle-${{ github.sha }}:1h jobs: check-title: @@ -21,21 +18,14 @@ jobs: build-operator: needs: check-title runs-on: ubuntu-latest + env: + IMG: ttl.sh/konveyor-operator-${{ github.sha }}:1h steps: - uses: actions/checkout@v3 - run: make docker-build docker-push - build-bundle: + run-ci: needs: build-operator - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - run: make bundle bundle-build bundle-push - - operator-install: - needs: build-bundle - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - run: make start-minikube - - run: OPERATOR_BUNDLE_IMAGE="${BUNDLE_IMG}" make install-tackle + uses: konveyor/ci/.github/workflows/global-ci-bundle.yml@main + with: + operator: ttl.sh/konveyor-operator-${{ github.sha }}:1h diff --git a/hack/install-konveyor.sh b/hack/install-konveyor.sh index 96415719..f13c5baa 100755 --- a/hack/install-konveyor.sh +++ b/hack/install-konveyor.sh @@ -21,6 +21,7 @@ PATH="${__bin_dir}:${PATH}" NAMESPACE="${NAMESPACE:-konveyor-tackle}" OPERATOR_BUNDLE_IMAGE="${OPERATOR_BUNDLE_IMAGE:-quay.io/konveyor/tackle2-operator-bundle:latest}" TACKLE_CR="${TACKLE_CR:-}" +TIMEOUT="${TIMEOUT:-10m}" if ! command -v kubectl >/dev/null 2>&1; then kubectl_bin="${__bin_dir}/kubectl" @@ -38,21 +39,36 @@ if ! command -v operator-sdk >/dev/null 2>&1; then chmod +x "${operator_sdk_bin}" fi +debug() { + echo "Install Konveyor FAILED!!!" + echo "What follows is some info that may be useful in debugging the failure" + + kubectl get namespace "${NAMESPACE}" -o yaml || true + kubectl get --namespace "${NAMESPACE}" all || true + kubectl get --namespace "${NAMESPACE}" -o yaml \ + subscriptions.operators.coreos.com,catalogsources.operators.coreos.com,installplans.operators.coreos.com,clusterserviceversions.operators.coreos.com \ + || true + kubectl get --namespace "${NAMESPACE}" -o yaml tackles.tackle.konveyor.io/tackle || true + + for pod in $(kubectl get pods -n "${NAMESPACE}" -o jsonpath='{.items[*].metadata.name}'); do + kubectl --namespace "${NAMESPACE}" describe pod "${pod}" || true + done + exit 1 +} +trap 'debug' EXIT + run_bundle() { kubectl auth can-i create namespace --all-namespaces kubectl create namespace "${NAMESPACE}" || true - operator-sdk run bundle "${OPERATOR_BUNDLE_IMAGE}" --namespace "${NAMESPACE}" + operator-sdk run bundle "${OPERATOR_BUNDLE_IMAGE}" --namespace "${NAMESPACE}" --timeout "${TIMEOUT}" # If on MacOS, need to install `brew install coreutils` to get `timeout` - timeout 600s bash -c 'until kubectl get customresourcedefinitions.apiextensions.k8s.io tackles.tackle.konveyor.io; do sleep 30; done' \ - || kubectl get subscription --namespace "${NAMESPACE}" -o yaml konveyor-operator # Print subscription details when timed out + timeout 600s bash -c 'until kubectl get customresourcedefinitions.apiextensions.k8s.io tackles.tackle.konveyor.io; do sleep 30; done' } install_tackle() { echo "Waiting for the Tackle CRD to become available" - kubectl wait \ - --namespace "${NAMESPACE}" \ - --for=condition=established \ + kubectl wait --namespace "${NAMESPACE}" --for=condition=established \ customresourcedefinitions.apiextensions.k8s.io/tackles.tackle.konveyor.io if [ -n "${TACKLE_CR}" ]; then @@ -76,11 +92,7 @@ EOF --namespace "${NAMESPACE}" \ --for=condition=Successful \ --timeout=600s \ - tackles.tackle.konveyor.io/tackle \ - || kubectl get \ - --namespace "${NAMESPACE}" \ - -o yaml \ - tackles.tackle.konveyor.io/tackle # Print tackle debug when timed out + tackles.tackle.konveyor.io/tackle # Now wait for all the tackle deployments kubectl wait \ @@ -88,13 +100,7 @@ EOF --selector="app.kubernetes.io/part-of=tackle" \ --for=condition=Available \ --timeout=600s \ - deployments.apps \ - || kubectl get \ - --namespace "${NAMESPACE}" \ - --selector="app.kubernetes.io/part-of=tackle" \ - --field-selector=status.phase!=Running \ - -o yaml \ - pods # Print not running tackle pods when timed out + deployments.apps } kubectl get customresourcedefinitions.apiextensions.k8s.io tackles.tackle.konveyor.io || run_bundle