@@ -364,11 +364,27 @@ jobs:
364364 make cert-manager
365365 SUPPORT_VOLUME_EXPANSION=false make system-tests
366366
367+ examples_matrix :
368+ runs-on : ubuntu-latest
369+ outputs :
370+ examples_matrix : ${{ steps.list_examples.outputs.examples_matrix }}
371+ steps :
372+ - name : Check out code
373+ uses : actions/checkout@v5
374+
375+ - name : List Examples
376+ id : list_examples
377+ run : |
378+ echo -n 'examples_matrix=' >> $GITHUB_OUTPUT
379+ find "$PWD/docs/examples" -mindepth 1 -type d | jq -R -s -c 'split("\n") | map(select(length > 0))' >> $GITHUB_OUTPUT
380+
367381 test_doc_examples :
368382 name : Documented example tests
369383 runs-on : ubuntu-latest
370- if : ${{ github.event_name != 'pull_request' }}
371- needs : build_operator
384+ needs : [build_operator, examples_matrix]
385+ strategy :
386+ matrix :
387+ example : ${{ fromJSON(needs.examples_matrix.outputs.examples_matrix) }}
372388 steps :
373389 - name : Check out code into the Go module directory
374390 uses : actions/checkout@v5
@@ -407,21 +423,39 @@ jobs:
407423
408424 - name : Install Operator build
409425 run : |
410- make destroy
411426 kind load image-archive /tmp/operator.tar --name examples-testing
412427 ytt -f tmp/cluster-operator.yml -f config/ytt/never_pull.yaml | kubectl apply -f-
413428 kubectl --namespace=rabbitmq-system wait --for=condition=Available deployment/rabbitmq-cluster-operator
414429
415- - name : Documented example tests
416- run : docs/examples/test.sh
430+ - name : Documented example ${{ matrix.example }} test
431+ env :
432+ example : ${{ matrix.example }}
433+ run : |
434+ # Exit early if this example is to be skipped in CI
435+ [[ -e "$example"/.ci-skip ]] && exit 0
436+
437+ make cert-manager
438+ printf "apiVersion: cert-manager.io/v1\nkind: ClusterIssuer\nmetadata:\n name: selfsigned-issuer\nspec:\n selfSigned: {}\n" | kubectl apply -f -
439+
440+ pushd "$example"
441+ kubectl create namespace examples
442+ kubectl config set-context --current --namespace=examples
443+ [[ -e setup.sh ]] && ./setup.sh
444+ kubectl apply -f rabbitmq.yaml --timeout=30s
445+ kubectl wait -f rabbitmq.yaml --for=condition=AllReplicasReady --timeout=5m
446+ kubectl wait -f rabbitmq.yaml --for=condition=ReconcileSuccess --timeout=5m
447+ ./test.sh
448+ kubectl delete -f rabbitmq.yaml --timeout=3m
449+ kubectl delete namespace examples --timeout=10m
450+ popd
417451
418452 - name : Notify Google Chat
419453 if : failure()
420454 uses : SimonScholz/google-chat-action@main
421455 with :
422456 webhookUrl : ' ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}'
423457 jobStatus : ${{ job.status }}
424- title : Cluster Operator - Documented example tests
458+ title : Cluster Operator - Documented example ${{ matrix.example }} test
425459
426460 test_upgrade :
427461 name : Test upgrade of the operator
0 commit comments