Merge pull request #223 from pawelpaszki/disconnected-workflow-fix #1
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: Dispatch E2E Tests | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| workflow_dispatch: | |
| jobs: | |
| run-e2e-on-bigger-runner: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Trigger kuberay e2e tests job | |
| uses: peter-evans/repository-dispatch@v3 | |
| with: | |
| token: ${{ secrets.KUBERAY_DISPATCH_TESTS }} | |
| repository: project-codeflare/kuberay-post-merge-tests | |
| event-type: branch-dispatch-e2e-post-merge | |
| - name: Poll Project-Codeflare kuberay-post-merge-tests repo for workflow completion | |
| env: | |
| GH_TOKEN: ${{ secrets.KUBERAY_DISPATCH_TESTS }} | |
| ORG: project-codeflare | |
| REPO: kuberay-post-merge-tests | |
| run: | | |
| # TODO - check if there is an existing run and abort if there is | |
| 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=="Test KubeRay Operator E2E Tests") | .id') | |
| if [ -z "$workflow_id" ]; then | |
| echo "❌ Workflow ID not found" && exit 1 | |
| fi | |
| for i in {1..10}; do | |
| run_id=$( | |
| gh api repos/$ORG/$REPO/actions/runs \ | |
| --paginate \ | |
| --jq "[.workflow_runs[] | select(.workflow_id==$workflow_id)] | first | .id" \ | |
| || true | |
| ) | |
| echo "$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 "❌ Workflow run not found" && exit 1 | |
| fi | |
| echo "Monitoring run ID $run_id..." | |
| # Poll for up to ~2.5 hours (150 iterations * 60 seconds = 9000 seconds) | |
| for i in {1..150}; 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 "✅ kuberay-post-merge-tests e2e workflow completed successfully" | |
| exit 0 | |
| else | |
| echo "❌ kuberay-post-merge-tests e2e workflow failed" | |
| exit 1 | |
| fi | |
| fi | |
| sleep 60 | |
| done | |
| echo "❌ Timeout waiting for kuberay-post-merge-tests e2e workflow" | |
| exit 1 |