Skip to content

Commit f4a067e

Browse files
authored
Soften plugin signal verification (#181)
1 parent f100266 commit f4a067e

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

scripts/verify_cloud_run_strategy_plugin_mounts.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,36 @@ def _check_signal_path(
160160
f"{service}:{env_name} signal_path is outside allowed prefixes: {signal_path}"
161161
)
162162

163-
signal_raw = _run(["gcloud", "storage", "cat", signal_path])
163+
try:
164+
signal_raw = _run(["gcloud", "storage", "cat", signal_path])
165+
except RuntimeError as exc:
166+
print(
167+
f"Warning: {service}:{env_name} signal_path is not readable yet; "
168+
f"strategy runtime will ignore the plugin until a valid signal exists: "
169+
f"{signal_path} ({exc})"
170+
)
171+
return
164172
try:
165173
signal = json.loads(signal_raw)
166174
except json.JSONDecodeError as exc:
167-
raise ValueError(f"{service}:{env_name} signal_path does not contain valid JSON: {signal_path}") from exc
175+
print(
176+
f"Warning: {service}:{env_name} signal_path does not contain valid JSON; "
177+
f"strategy runtime will ignore the plugin until it is fixed: {signal_path} ({exc})"
178+
)
179+
return
168180
if not isinstance(signal, dict):
169-
raise ValueError(f"{service}:{env_name} signal_path must contain a JSON object: {signal_path}")
181+
print(
182+
f"Warning: {service}:{env_name} signal_path must contain a JSON object; "
183+
f"strategy runtime will ignore the plugin until it is fixed: {signal_path}"
184+
)
185+
return
170186
if expected_schema and str(signal.get("schema_version") or "").strip() != expected_schema:
171-
raise ValueError(
172-
f"{service}:{env_name} expected schema {expected_schema}, "
173-
f"got {signal.get('schema_version')!r} at {signal_path}"
187+
print(
188+
f"Warning: {service}:{env_name} expected schema {expected_schema}, "
189+
f"got {signal.get('schema_version')!r} at {signal_path}; "
190+
"strategy runtime will ignore the plugin until it is fixed."
174191
)
192+
return
175193

176194

177195
def _verify_target(

0 commit comments

Comments
 (0)