Skip to content
Merged
Show file tree
Hide file tree
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
44 changes: 18 additions & 26 deletions .github/workflows/sync-cloud-run-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,18 @@ jobs:
gcloud "${gcloud_args[@]}"
done

- name: Reconcile Cloud Run traffic
if: steps.config.outputs.env_sync_enabled == 'true'
env:
SYNC_PLAN_JSON: ${{ steps.strategy_requirements.outputs.sync_plan_json }}
run: |
set -euo pipefail
python3 scripts/reconcile_cloud_runtime.py \
--platform=ibkr \
--project="${GCP_PROJECT_ID}" \
--region="${CLOUD_RUN_REGION}" \
--ensure-latest-traffic
Comment on lines +966 to +970

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify plugin mounts before shifting traffic

When a service's traffic is pinned to an older revision—the drift this step is meant to repair—this command moves 100% traffic to the latest revision before the immediately following Verify strategy plugin mounts step has checked that the synced IBKR_STRATEGY_PLUGIN_MOUNTS_JSON is present, valid, and allowed. If that verification then fails, the workflow stops only after the potentially bad latest revision has already been made live, so the traffic reconciliation should run after the verifier succeeds.

Useful? React with 👍 / 👎.


- name: Verify strategy plugin mounts
if: steps.config.outputs.env_sync_enabled == 'true'
env:
Expand Down Expand Up @@ -1149,32 +1161,12 @@ jobs:
--quiet
fi

for update in "${scheduler_updates[@]}"; do
IFS=$'\t' read -r cloud_run_service _market_timezone _main_time <<< "${update}"
legacy_candidates=()
if [[ "${cloud_run_service}" == *-service ]]; then
legacy_candidates+=("${cloud_run_service%-service}-probe-scheduler")
legacy_candidates+=("${cloud_run_service%-service}-precheck-scheduler")
fi
legacy_candidates+=("${cloud_run_service}-probe-scheduler")
legacy_candidates+=("${cloud_run_service}-precheck-scheduler")
account_suffix="${cloud_run_service#interactive-brokers-quant-live-}"
account_suffix="${account_suffix%-service}"
if [[ "${account_suffix}" == u* ]]; then
legacy_candidates+=("ibkr-${account_suffix}-backup-execution")
fi
for legacy_job in "${legacy_candidates[@]}"; do
if gcloud scheduler jobs describe "${legacy_job}" \
--project="${GCP_PROJECT_ID}" \
--location="${scheduler_location}" >/dev/null 2>&1; then
echo "Deleting legacy Cloud Scheduler job ${legacy_job}; monitor dispatcher now owns probe/precheck."
gcloud scheduler jobs delete "${legacy_job}" \
--project="${GCP_PROJECT_ID}" \
--location="${scheduler_location}" \
--quiet
fi
done
done
python3 scripts/reconcile_cloud_runtime.py \
--platform=ibkr \
--project="${GCP_PROJECT_ID}" \
--region="${CLOUD_RUN_REGION}" \
--scheduler-location="${scheduler_location}" \
--delete-legacy-schedulers

- name: Prune old Cloud Run revisions
if: steps.config.outputs.enabled == 'true'
Expand Down
Loading
Loading