Enable pr testing #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Trigger SDK E2E Tests on PR | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| branches: | |
| - main | |
| jobs: | |
| trigger-remote-e2e: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: SDK PR Notebook E2E Runner | |
| uses: peter-evans/repository-dispatch@v3 | |
| with: | |
| token: ${{ secrets.KUBEFLOW_E2E_DISPATCH_TOKEN }} | |
| repository: Fiona-Waters/kubeflow-devx-post-merge-tests | |
| event-type: run-sdk-pr-e2e-tests | |
| client-payload: '{ | |
| "sdk_repo": "${{ github.repository }}", | |
| "sdk_ref": "${{ github.event.pull_request.head.ref }}", | |
| "sdk_sha": "${{ github.event.pull_request.head.sha }}", | |
| "training_operator_repo_owner": "opendatahub-io", | |
| "training_operator_repo_name": "trainer", | |
| "training_operator_ref": "main" | |
| }' | |
| - name: Poll for remote E2E workflow completion | |
| env: | |
| GH_TOKEN: ${{ secrets.KUBEFLOW_E2E_DISPATCH_TOKEN }} | |
| ORG: Fiona-Waters | |
| REPO: kubeflow-devx-post-merge-tests | |
| run: | | |
| sleep 30 # to allow for run to start | |
| echo "Polling $ORG/$REPO..." | |
| workflow_id=$(gh api repos/$ORG/$REPO/actions/workflows \ | |
| | jq -r '.workflows[] | select(.name=="SDK PR Notebook E2E Runner") | .id' \ | |
| | head -1) | |
| if [ -z "$workflow_id" ]; then | |
| echo "Error: Workflow ID not found. Make sure the workflow name matches exactly." && exit 1 | |
| fi | |
| echo "Found workflow ID: $workflow_id" | |
| # Wait for the workflow run to appear (retry up to 10 times, 5 seconds apart) | |
| for i in {1..10}; do | |
| run_id=$( | |
| gh api repos/$ORG/$REPO/actions/runs \ | |
| | jq -r ".workflow_runs[] | select(.workflow_id==$workflow_id) | .id" \ | |
| | head -1 \ | |
| || true | |
| ) | |
| echo "Attempt $i: run_id=$run_id" | |
| if [[ -n "$run_id" && "$run_id" != "null" ]]; then | |
| break | |
| fi | |
| echo "Waiting for run to start..." | |
| sleep 5 | |
| done | |
| if [ -z "$run_id" ]; then | |
| echo "Error: Workflow run not found" && exit 1 | |
| fi | |
| echo "Monitoring run ID $run_id..." | |
| echo "View logs at: https://github.com/$ORG/$REPO/actions/runs/$run_id" | |
| # Poll for completion (up to 90 times, 30 seconds apart = 45 minutes max) | |
| for i in {1..90}; do | |
| status=$(gh api repos/$ORG/$REPO/actions/runs/$run_id --jq '.status') | |
| conclusion=$(gh api repos/$ORG/$REPO/actions/runs/$run_id --jq '.conclusion') | |
| echo "Status: $status | Conclusion: $conclusion" | |
| if [[ "$status" == "completed" ]]; then | |
| if [[ "$conclusion" == "success" ]]; then | |
| echo "Success: Remote E2E tests completed successfully" | |
| exit 0 | |
| else | |
| echo "Error: Remote E2E tests failed with conclusion: $conclusion" | |
| echo "View logs at: https://github.com/$ORG/$REPO/actions/runs/$run_id" | |
| exit 1 | |
| fi | |
| fi | |
| sleep 30 | |
| done | |
| echo "Error: Timeout waiting for remote E2E workflow" | |
| exit 1 |