Skip to content

Commit 29fea7e

Browse files
anrzeszutekcopybara-github
authored andcommitted
fix: Fix deploy to cloud run on Windows
Merge #3536 - Closes: #1597 - Related: #3306 COPYBARA_INTEGRATE_REVIEW=#3536 from anrzeszutek:main ab9f6bf PiperOrigin-RevId: 832441843
1 parent 7c993b0 commit 29fea7e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/google/adk/cli/cli_deploy.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
import click
2525
from packaging.version import parse
2626

27+
_IS_WINDOWS = os.name == 'nt'
28+
_GCLOUD_CMD = 'gcloud.cmd' if _IS_WINDOWS else 'gcloud'
29+
2730
_DOCKERFILE_TEMPLATE: Final[str] = """
2831
FROM python:3.11-slim
2932
WORKDIR /app
@@ -378,7 +381,7 @@ def _resolve_project(project_in_option: Optional[str]) -> str:
378381
return project_in_option
379382

380383
result = subprocess.run(
381-
['gcloud', 'config', 'get-value', 'project'],
384+
[_GCLOUD_CMD, 'config', 'get-value', 'project'],
382385
check=True,
383386
capture_output=True,
384387
text=True,
@@ -585,7 +588,7 @@ def to_cloud_run(
585588

586589
# Build the command with extra gcloud args
587590
gcloud_cmd = [
588-
'gcloud',
591+
_GCLOUD_CMD,
589592
'run',
590593
'deploy',
591594
service_name,

tests/unittests/cli/utils/test_cli_deploy_to_cloud_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def test_to_cloud_run_happy_path(
173173
gcloud_args = run_recorder.get_last_call_args()[0]
174174

175175
expected_gcloud_command = [
176-
"gcloud",
176+
cli_deploy._GCLOUD_CMD,
177177
"run",
178178
"deploy",
179179
"svc",

0 commit comments

Comments
 (0)