Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
Try running E2E tests on PRs by leveraging the already built operator…
Browse files Browse the repository at this point in the history
… image
  • Loading branch information
rm3l committed Feb 17, 2024
1 parent d1b21b8 commit e9c4259
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,7 +38,7 @@ jobs:
run: |
# don't fail if nothing returned by grep
set +e
CHANGES="$(git diff --name-only HEAD~1 | \
CHANGES="$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | \
grep -E "workflows/pr.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go" | \
grep -v -E "/.rhdh/")";
echo "Changed files for this commit:"
Expand Down Expand Up @@ -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

0 comments on commit e9c4259

Please sign in to comment.