From 68c125ac57f60e991e1ff331a73b96607aed4d06 Mon Sep 17 00:00:00 2001 From: Armel Soro Date: Sun, 18 Feb 2024 00:33:13 +0100 Subject: [PATCH] Try running E2E tests on PRs by leveraging the already built operator image --- .github/workflows/pr.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index b7f5d027..9441bfab 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -25,6 +25,8 @@ jobs: pr-validate: name: PR Validate runs-on: ubuntu-latest + env: + CONTAINER_ENGINE: podman steps: - name: Checkout uses: actions/checkout@v4 @@ -71,3 +73,27 @@ jobs: with: # Path to SARIF file relative to the root of the repository sarif_file: gosec.sarif + + - name: Prepare E2E Tests for PR by waiting until operator image is built and published + # run this stage only if there are changes that match the includes and not the excludes + if: ${{ env.CHANGES != '' }} + timeout-minutes: 600 + run: | + SHORT_SHA=$(git rev-parse --short HEAD) + BASE_VERSION=$(grep -E "^VERSION \?=" Makefile | sed -r -e "s/.+= //") # 0.1.0 + OPERATOR_IMAGE="quay.io/janus-idp/operator:${BASE_VERSION}-pr-${{ github.event.number }}-${SHORT_SHA}" + echo "Waiting until operator image is found or timeout expires: ${OPERATOR_IMAGE}..." + until ${CONTAINER_ENGINE} image pull "${OPERATOR_IMAGE}" &> /dev/null; do + echo -n . + done + echo "... operator image found: ${OPERATOR_IMAGE}." + echo "OPERATOR_IMAGE=${OPERATOR_IMAGE}" >> $GITHUB_ENV + - name: Start Minikube + uses: medyagh/setup-minikube@606b71970c783154fe49b711486c717f5780f485 # v0.0.15 + with: + addons: ingress + - name: Run E2E tests + env: + BACKSTAGE_OPERATOR_TESTS_PLATFORM: minikube + IMG: ${{ env.OPERATOR_IMAGE }} + run: make test-e2e