mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-13 15:14:50 -06:00
feat!: add --adk_version
arg to adk deploy cloud_run
.
The default version for Cloud Run deployment is changed to the version in the dev environment instead of the latest version. PiperOrigin-RevId: 759767654
This commit is contained in:
parent
801549f734
commit
a1ddf0b6cc
@ -42,7 +42,7 @@ ENV GOOGLE_CLOUD_LOCATION={gcp_region}
|
||||
# Set up environment variables - End
|
||||
|
||||
# Install ADK - Start
|
||||
RUN pip install google-adk
|
||||
RUN pip install google-adk=={adk_version}
|
||||
# Install ADK - End
|
||||
|
||||
# Copy agent - Start
|
||||
@ -86,6 +86,7 @@ def to_cloud_run(
|
||||
with_ui: bool,
|
||||
verbosity: str,
|
||||
session_db_url: str,
|
||||
adk_version: str,
|
||||
):
|
||||
"""Deploys an agent to Google Cloud Run.
|
||||
|
||||
@ -114,6 +115,7 @@ def to_cloud_run(
|
||||
with_ui: Whether to deploy with UI.
|
||||
verbosity: The verbosity level of the CLI.
|
||||
session_db_url: The database URL to connect the session.
|
||||
adk_version: The ADK version to use in Cloud Run.
|
||||
"""
|
||||
app_name = app_name or os.path.basename(agent_folder)
|
||||
|
||||
@ -150,6 +152,7 @@ def to_cloud_run(
|
||||
if session_db_url
|
||||
else '',
|
||||
trace_to_cloud_option='--trace_to_cloud' if trace_to_cloud else '',
|
||||
adk_version=adk_version,
|
||||
)
|
||||
dockerfile_path = os.path.join(temp_folder, 'Dockerfile')
|
||||
os.makedirs(temp_folder, exist_ok=True)
|
||||
|
@ -18,8 +18,6 @@ from datetime import datetime
|
||||
import logging
|
||||
import os
|
||||
import tempfile
|
||||
from typing import AsyncGenerator
|
||||
from typing import Coroutine
|
||||
from typing import Optional
|
||||
|
||||
import click
|
||||
@ -28,6 +26,7 @@ import uvicorn
|
||||
|
||||
from . import cli_create
|
||||
from . import cli_deploy
|
||||
from .. import version
|
||||
from .cli import run_cli
|
||||
from .cli_eval import MISSING_EVAL_DEPENDENCIES_MESSAGE
|
||||
from .fast_api import get_fast_api_app
|
||||
@ -712,6 +711,16 @@ def cli_api_server(
|
||||
exists=True, dir_okay=True, file_okay=False, resolve_path=True
|
||||
),
|
||||
)
|
||||
@click.option(
|
||||
"--adk_version",
|
||||
type=str,
|
||||
default=version.__version__,
|
||||
show_default=True,
|
||||
help=(
|
||||
"Optional. The ADK version used in Cloud Run deployment. (default: the"
|
||||
" version in the dev environment)"
|
||||
),
|
||||
)
|
||||
def cli_deploy_cloud_run(
|
||||
agent: str,
|
||||
project: Optional[str],
|
||||
@ -724,6 +733,7 @@ def cli_deploy_cloud_run(
|
||||
with_ui: bool,
|
||||
verbosity: str,
|
||||
session_db_url: str,
|
||||
adk_version: str,
|
||||
):
|
||||
"""Deploys an agent to Cloud Run.
|
||||
|
||||
@ -746,6 +756,7 @@ def cli_deploy_cloud_run(
|
||||
with_ui=with_ui,
|
||||
verbosity=verbosity,
|
||||
session_db_url=session_db_url,
|
||||
adk_version=adk_version,
|
||||
)
|
||||
except Exception as e:
|
||||
click.secho(f"Deploy failed: {e}", fg="red", err=True)
|
||||
|
@ -124,6 +124,7 @@ def test_to_cloud_run_happy_path(
|
||||
with_ui=True,
|
||||
verbosity="info",
|
||||
session_db_url="sqlite://",
|
||||
adk_version="0.0.5",
|
||||
)
|
||||
|
||||
# Assertions
|
||||
@ -163,6 +164,7 @@ def test_to_cloud_run_cleans_temp_dir(
|
||||
with_ui=False,
|
||||
verbosity="info",
|
||||
session_db_url=None,
|
||||
adk_version="0.0.5",
|
||||
)
|
||||
|
||||
assert deleted["path"] == tmp_dir
|
||||
|
Loading…
Reference in New Issue
Block a user