@@ -94,3 +94,34 @@ def test_runtime_guard_callers_use_locked_uv_runtime_before_authentication() ->
9494 "google-github-actions/auth@v3"
9595 )
9696 assert setup_python_lines == [f" uses: { setup_python } " ]
97+
98+
99+ def test_lifecycle_observes_completed_sync_regardless_of_conclusion () -> None :
100+ workflow = (ROOT / ".github/workflows/runtime-target-lifecycle.yml" ).read_text ()
101+ sync = (ROOT / ".github/workflows/sync-cloud-run-env.yml" ).read_text ()
102+ sync_name = sync .splitlines ()[0 ].removeprefix ("name: " )
103+
104+ assert f'workflows: ["{ sync_name } "]' in workflow
105+ assert "types: [completed]" in workflow
106+ assert "github.event.workflow_run.conclusion" not in workflow
107+ assert "github.event.workflow_run.head_sha" not in workflow
108+
109+
110+ def test_lifecycle_publishes_read_only_observation_for_exact_service () -> None :
111+ workflow = (ROOT / ".github/workflows/runtime-target-lifecycle.yml" ).read_text ()
112+ publisher = workflow .split ("- name: Publish lifecycle to the unified control plane" , 1 )[1 ]
113+ publisher = publisher .split ("\n - name:" , 1 )[0 ]
114+
115+ for line in (
116+ "observe-gcp: 'true'" ,
117+ "gcp-project: ${{ env.GCP_PROJECT_ID }}" ,
118+ "cloud-run-region: ${{ env.CLOUD_RUN_REGION }}" ,
119+ "cloud-run-service: ${{ env.CLOUD_RUN_SERVICE }}" ,
120+ "scheduler-location: ${{ env.RUNTIME_HEARTBEAT_SCHEDULER_LOCATION }}" ,
121+ ):
122+ assert line in publisher
123+ assert "CLOUD_RUN_SERVICE: ${{ secrets.CLOUD_RUN_SERVICE }}" in workflow
124+ assert "RUNTIME_HEARTBEAT_SCHEDULER_LOCATION: ${{ vars.RUNTIME_HEARTBEAT_SCHEDULER_LOCATION || vars.CLOUD_RUN_REGION || 'us-central1' }}" in workflow
125+ assert "CLOUD_RUN_SERVICES" not in publisher
126+ assert "gcloud scheduler jobs update" not in workflow
127+ assert "gcloud run deploy" not in workflow
0 commit comments