Skip to content

Trigger operator e2e on PR approval, and wait for its result. #3442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 40 additions & 12 deletions .github/workflows/operator-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,60 @@ on:
workflow_dispatch:
inputs:
mirrord_commit:
description: 'Mirrord commit to use for E2E tests'
description: "Mirrord commit to use for E2E tests"
required: true
type: string
mirrord_branch:
description: 'Mirrord branch to use for E2E tests'
description: "Mirrord branch to use for E2E tests"
required: true
type: string
operator_branch:
description: 'Operator branch to use for E2E tests'
description: "Operator branch to use for E2E tests"
required: false
type: string
default: 'main'
default: "main"
pull_request_review:
types: [submitted]

jobs:
trigger-operator-e2e:
runs-on: ubuntu-latest
continue-on-error: true
# Only run for approved reviews on PRs targeting protected branches
if: >
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request_review' &&
github.event.review.state == 'approved' &&
(github.event.pull_request.base.ref == 'main' ||
github.event.pull_request.base.ref == 'staging'))
steps:
- name: Trigger operator E2E workflow
uses: metalbear-co/repository-dispatch@main
- name: Generate unique run ID
id: run-id
run: echo "run_id=mirrord-e2e-$(date +%s)-${{ github.run_id }}" >> $GITHUB_OUTPUT

- name: Trigger operator E2E workflow and wait for completion
id: trigger-e2e
uses: metalbear-co/return-dispatch@main
continue-on-error: true
with:
token: ${{ secrets.OPERATOR_E2E_PAT }}
repository: metalbear-co/operator
event-type: operator-e2e-test-from-mirrord
client-payload: |
ref: ${{ inputs.operator_branch || 'main' }}
repo: operator
owner: metalbear-co
workflow: operator-e2e.yaml
workflow_inputs: |
{
"branch": "${{ inputs.operator_branch }}",
"mirrord_commit": "${{ inputs.mirrord_commit }}",
"mirrord_branch": "${{ inputs.mirrord_branch }}"
"mirrord_commit": "${{ inputs.mirrord_commit || github.event.pull_request.head.sha }}",
"mirrord_branch": "${{ inputs.mirrord_branch || github.event.pull_request.head.ref }}",
"distinct_id": "${{ steps.run-id.outputs.run_id }}"
}
workflow_timeout_seconds: 7200
workflow_job_steps_retry_seconds: 30
distinct_id: ${{ steps.run-id.outputs.run_id }}

- name: Show operator E2E results
run: |
echo "✅ Operator E2E tests completed successfully!"
echo "Run ID: ${{ steps.trigger-e2e.outputs.run_id }}"
echo "Run URL: ${{ steps.trigger-e2e.outputs.run_url }}"
echo "Distinct ID used: ${{ steps.run-id.outputs.run_id }}"
Loading