Skip to content

Commit 511b78a

Browse files
Pigbibicodex
andcommitted
fix: support array scheduler targets
Co-Authored-By: Codex <noreply@openai.com>
1 parent 67a3713 commit 511b78a

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

.github/workflows/sync-cloud-run-env.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,13 @@ jobs:
13031303
import os
13041304
13051305
payload = json.loads(os.environ.get("CLOUD_RUN_SERVICE_TARGETS_JSON") or "{}")
1306-
for target in payload.get("targets") or []:
1306+
if isinstance(payload, list):
1307+
targets = payload
1308+
elif isinstance(payload, dict):
1309+
targets = payload.get("targets") or []
1310+
else:
1311+
targets = []
1312+
for target in targets:
13071313
if not isinstance(target, dict):
13081314
continue
13091315
service_name = str(target.get("service_name") or target.get("service") or "").strip()

tests/test_scheduler_workflow.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ def test_replacement_verifier_falls_back_to_global_scheduler_location() -> None:
2626
workflow = Path(".github/workflows/sync-cloud-run-env.yml").read_text(encoding="utf-8")
2727
cleanup_section = workflow[workflow.index("cleanup-shared-monitor:") :]
2828

29+
assert "if isinstance(payload, list):" in cleanup_section
30+
assert "elif isinstance(payload, dict):" in cleanup_section
31+
assert "for target in targets:" in cleanup_section
2932
assert 'or os.environ.get("CLOUD_SCHEDULER_LOCATION")' in cleanup_section
3033
assert 'or os.environ.get("CLOUD_RUN_REGION")' in cleanup_section
3134

0 commit comments

Comments
 (0)