103 lines
3.6 KiB
YAML
103 lines
3.6 KiB
YAML
# UNUSED: autopilot integration is disabled. No workflow calls this file.
|
|
# Kept on disk for historical reference. Do not re-add a caller without
|
|
# also reverting the `checkAutopilotAvailable()` short-circuit in
|
|
# `ui/app/utils/config/index.server.ts`.
|
|
name: Dispatch Autopilot E2E Tests
|
|
|
|
permissions: {}
|
|
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
AUTOPILOT_DISPATCH_APP_ID:
|
|
required: true
|
|
AUTOPILOT_DISPATCH_PRIVATE_KEY:
|
|
required: true
|
|
|
|
jobs:
|
|
dispatch-autopilot:
|
|
name: dispatch-autopilot
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
if: github.repository == 'tensorzero/tensorzero'
|
|
permissions:
|
|
contents: read # Required for checkout or repository metadata reads.
|
|
steps:
|
|
- name: Generate GitHub App token
|
|
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
|
|
id: app-token
|
|
with:
|
|
app-id: ${{ secrets.AUTOPILOT_DISPATCH_APP_ID }}
|
|
private-key: ${{ secrets.AUTOPILOT_DISPATCH_PRIVATE_KEY }}
|
|
owner: tensorzero
|
|
repositories: autopilot
|
|
|
|
- name: Dispatch to autopilot
|
|
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
|
|
with:
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
repository: tensorzero/autopilot
|
|
event-type: tensorzero-main-updated
|
|
client-payload: |
|
|
{
|
|
"tensorzero_commit": "${{ github.sha }}",
|
|
"triggered_by": "${{ github.actor }}",
|
|
"source_run_id": "${{ github.run_id }}",
|
|
"source_run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
}
|
|
|
|
- name: Wait for autopilot workflow to complete
|
|
env:
|
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
SOURCE_RUN_ID: ${{ github.run_id }}
|
|
run: |
|
|
EXPECTED_NAME="Cross-Repo E2E (tensorzero/$SOURCE_RUN_ID)"
|
|
echo "Looking for workflow run with name: $EXPECTED_NAME"
|
|
|
|
sleep 10
|
|
|
|
# Find the workflow run by display_title (correlates to our specific dispatch)
|
|
for i in {1..120}; do
|
|
RUN_ID=$(gh api repos/tensorzero/autopilot/actions/runs \
|
|
-q ".workflow_runs[] | select(.display_title==\"$EXPECTED_NAME\") | .id") || {
|
|
echo "::warning::gh api request failed (attempt $i/120), possibly throttled. Retrying..."
|
|
sleep 10
|
|
continue
|
|
}
|
|
|
|
if [ -n "$RUN_ID" ]; then
|
|
break
|
|
fi
|
|
sleep 5
|
|
done
|
|
|
|
if [ -z "$RUN_ID" ]; then
|
|
echo "Failed to find autopilot workflow run with name: $EXPECTED_NAME"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Autopilot workflow: https://github.com/tensorzero/autopilot/actions/runs/$RUN_ID"
|
|
|
|
# Poll until complete
|
|
while true; do
|
|
RESULT=$(gh api "repos/tensorzero/autopilot/actions/runs/$RUN_ID" -q '{status: .status, conclusion: .conclusion}') || {
|
|
echo "::warning::gh api request failed, possibly throttled. Retrying..."
|
|
sleep 30
|
|
continue
|
|
}
|
|
STATUS=$(echo "$RESULT" | jq -r '.status')
|
|
CONCLUSION=$(echo "$RESULT" | jq -r '.conclusion')
|
|
|
|
if [ "$STATUS" = "completed" ]; then
|
|
if [ "$CONCLUSION" = "success" ]; then
|
|
echo "Autopilot E2E tests passed"
|
|
exit 0
|
|
else
|
|
echo "Autopilot E2E tests failed with conclusion: $CONCLUSION"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
sleep 30
|
|
done
|