diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index d98b40043..de5bd2d8b 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -57,6 +57,7 @@ jobs: NODE_OPTIONS: --max_old_space_size=16384 run: xvfb-run npm run test:coverage --silent + # Install and start KinD cluster - name: Start KinD cluster if: (success() || failure()) && runner.os == 'Linux' uses: helm/kind-action@v1.14.0 @@ -64,21 +65,65 @@ jobs: version: v0.31.0 node_image: kindest/node:v1.34.0 + # Configure cluster - name: Configure cluster if: (success() || failure()) && runner.os == 'Linux' run: | - curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.19.1/install.sh | bash -s v0.19.1 - kubectl create -f https://operatorhub.io/install/service-binding-operator.yaml - kubectl create -f https://operatorhub.io/install/cloudnative-pg.yaml - nb=0 - echo -n "Waiting for operator to show up " - while [ "$nb" != "2" ] - do + set -euo pipefail + + echo "Installing CloudNativePG..." + kubectl create -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.28/releases/cnpg-1.28.1.yaml + + echo "Installing OLM (for SBO)..." + kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.42.0/crds.yaml + kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.42.0/olm.yaml + + kubectl wait --for=condition=Available deployment -n olm --all --timeout=180s + + echo "Installing Service Binding Operator via OLM..." + kubectl apply -f https://operatorhub.io/install/service-binding-operator.yaml + + echo "Waiting for operators..." + + # CNPG + kubectl wait --for=condition=Available deployment -n cnpg-system --all --timeout=180s + + # OLM async flow + echo -n "Waiting for Service Binding Operator CSV to appear " + + timeout=300 + elapsed=0 + + while ! kubectl get csv -n operators 2>/dev/null | grep -q service-binding-operator; do echo -n "." sleep 1 - nb=`kubectl get pods -n operators --no-headers --ignore-not-found | grep Running | wc -l` + elapsed=$((elapsed+1)) + + if [ "$elapsed" -ge "$timeout" ]; then + echo "" + echo "❌ Timeout waiting for Service Binding Operator CSV" + + kubectl get subscription -n operators || true + kubectl get installplan -n operators || true + kubectl get csv -n operators || true + kubectl get pods -n operators || true + + exit 1 + fi done - echo CLUSTER_URL=`kubectl cluster-info | sed -n -e "s/\x1B\[[0-9;]*[a-zA-Z]//g" -e '1s/.*running at \(.*\)$/\1/p'` >> $GITHUB_ENV + + echo "" + + echo "Waiting for Service Binding Operator CSV to succeed..." + kubectl wait --for=jsonpath='{.status.phase}'=Succeeded \ + csv -n operators --all --timeout=300s + + # Now safe + kubectl wait --for=condition=Available deployment -n operators --all --timeout=180s + + echo "Extracting cluster URL..." + echo "CLUSTER_URL=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')" >> $GITHUB_ENV + # UI tests fail under linux # Run UI tests - name: Run UI Tests