|
| 1 | +name: Collect IBKR Reconciliation Evidence |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + target: |
| 7 | + description: "Frozen live target to read; this workflow has no order path." |
| 8 | + required: true |
| 9 | + default: all |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - all |
| 13 | + - soxl_soxx_trend_income |
| 14 | + - tqqq_growth_income |
| 15 | + - global_etf_rotation |
| 16 | + - russell_top50_leader_rotation |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + id-token: write |
| 21 | + |
| 22 | +env: |
| 23 | + GCP_PROJECT_ID: interactivebrokersquant |
| 24 | + GCP_REGION: us-central1 |
| 25 | + GCP_WORKLOAD_IDENTITY_PROVIDER: projects/303168642265/locations/global/workloadIdentityPools/github-actions/providers/github-main |
| 26 | + GCP_WORKLOAD_IDENTITY_SERVICE_ACCOUNT: ibkr-platform-deploy@interactivebrokersquant.iam.gserviceaccount.com |
| 27 | + |
| 28 | +concurrency: |
| 29 | + group: ibkr-reconciliation-evidence-${{ inputs.target }} |
| 30 | + cancel-in-progress: false |
| 31 | + |
| 32 | +jobs: |
| 33 | + collect: |
| 34 | + name: Read ${{ matrix.profile }} baseline evidence |
| 35 | + if: ${{ inputs.target == 'all' || inputs.target == matrix.profile }} |
| 36 | + runs-on: ubuntu-latest |
| 37 | + timeout-minutes: 10 |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + matrix: |
| 41 | + include: |
| 42 | + - profile: soxl_soxx_trend_income |
| 43 | + service: interactive-brokers-quant-live-u15998061-service |
| 44 | + - profile: tqqq_growth_income |
| 45 | + service: interactive-brokers-quant-live-u16608560-service |
| 46 | + - profile: global_etf_rotation |
| 47 | + service: interactive-brokers-quant-live-u18308207-service |
| 48 | + - profile: russell_top50_leader_rotation |
| 49 | + service: interactive-brokers-quant-live-u18336562-service |
| 50 | + steps: |
| 51 | + - name: Authenticate to Google Cloud |
| 52 | + uses: google-github-actions/auth@v3 |
| 53 | + with: |
| 54 | + workload_identity_provider: ${{ env.GCP_WORKLOAD_IDENTITY_PROVIDER }} |
| 55 | + service_account: ${{ env.GCP_WORKLOAD_IDENTITY_SERVICE_ACCOUNT }} |
| 56 | + |
| 57 | + - name: Set up gcloud |
| 58 | + uses: google-github-actions/setup-gcloud@v3 |
| 59 | + |
| 60 | + - name: Collect no-order reconciliation candidate |
| 61 | + env: |
| 62 | + SERVICE: ${{ matrix.service }} |
| 63 | + PROFILE: ${{ matrix.profile }} |
| 64 | + run: | |
| 65 | + set -euo pipefail |
| 66 | + service_url="$(gcloud run services describe "$SERVICE" --project "$GCP_PROJECT_ID" --region "$GCP_REGION" --format='value(status.url)')" |
| 67 | + test -n "$service_url" |
| 68 | + identity_token="$(gcloud auth print-identity-token --audiences="$service_url")" |
| 69 | + mkdir -p reports |
| 70 | + curl --fail --silent --show-error --max-time 90 \ |
| 71 | + --request POST \ |
| 72 | + --header "Authorization: Bearer ${identity_token}" \ |
| 73 | + --output "reports/${PROFILE}.json" \ |
| 74 | + "${service_url}/reconcile" |
| 75 | + jq -e --arg profile "$PROFILE" ' |
| 76 | + .schema_version == "ibkr_reconciliation_candidate.v1" |
| 77 | + and .evidence.platform_id == "ibkr" |
| 78 | + and .evidence.strategy_profile == $profile |
| 79 | + and (.recovery_blockers | type == "array") |
| 80 | + ' "reports/${PROFILE}.json" >/dev/null |
| 81 | + jq -r '[.permits_active_lkg, .expected_digests_configured, (.recovery_blockers | length)] | @tsv' \ |
| 82 | + "reports/${PROFILE}.json" | awk -F '\t' '{print "candidate_collected permits_active_lkg=" $1 ", expected_digests_configured=" $2 ", blockers=" $3}' |
| 83 | +
|
| 84 | + - name: Retain redacted candidate |
| 85 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 |
| 86 | + with: |
| 87 | + name: ibkr-reconciliation-${{ matrix.profile }}-${{ github.run_id }} |
| 88 | + path: reports/${{ matrix.profile }}.json |
| 89 | + if-no-files-found: error |
| 90 | + retention-days: 30 |
0 commit comments