From 29fea7ec1fb27989f07c90494b2d6acbe76c03d8 Mon Sep 17 00:00:00 2001 From: anrzeszutek Date: Fri, 14 Nov 2025 13:41:25 -0800 Subject: [PATCH] fix: Fix deploy to cloud run on Windows Merge https://github.com/google/adk-python/pull/3536 - Closes: #1597 - Related: #3306 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/3536 from anrzeszutek:main ab9f6bfcd51b373934c0c03ef41c880ce224b31d PiperOrigin-RevId: 832441843 --- src/google/adk/cli/cli_deploy.py | 7 +++++-- tests/unittests/cli/utils/test_cli_deploy_to_cloud_run.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/google/adk/cli/cli_deploy.py b/src/google/adk/cli/cli_deploy.py index 1467e1e4..1bf1d76c 100644 --- a/src/google/adk/cli/cli_deploy.py +++ b/src/google/adk/cli/cli_deploy.py @@ -24,6 +24,9 @@ from typing import Optional import click from packaging.version import parse +_IS_WINDOWS = os.name == 'nt' +_GCLOUD_CMD = 'gcloud.cmd' if _IS_WINDOWS else 'gcloud' + _DOCKERFILE_TEMPLATE: Final[str] = """ FROM python:3.11-slim WORKDIR /app @@ -378,7 +381,7 @@ def _resolve_project(project_in_option: Optional[str]) -> str: return project_in_option result = subprocess.run( - ['gcloud', 'config', 'get-value', 'project'], + [_GCLOUD_CMD, 'config', 'get-value', 'project'], check=True, capture_output=True, text=True, @@ -585,7 +588,7 @@ def to_cloud_run( # Build the command with extra gcloud args gcloud_cmd = [ - 'gcloud', + _GCLOUD_CMD, 'run', 'deploy', service_name, diff --git a/tests/unittests/cli/utils/test_cli_deploy_to_cloud_run.py b/tests/unittests/cli/utils/test_cli_deploy_to_cloud_run.py index cc5c30c2..17e91e98 100644 --- a/tests/unittests/cli/utils/test_cli_deploy_to_cloud_run.py +++ b/tests/unittests/cli/utils/test_cli_deploy_to_cloud_run.py @@ -173,7 +173,7 @@ def test_to_cloud_run_happy_path( gcloud_args = run_recorder.get_last_call_args()[0] expected_gcloud_command = [ - "gcloud", + cli_deploy._GCLOUD_CMD, "run", "deploy", "svc",