mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
feat: Respect the .ae_ignore file when deploying to agent engine
PiperOrigin-RevId: 788052720
This commit is contained in:
committed by
Copybara-Service
parent
f1889ae440
commit
f29ab5db05
@@ -315,8 +315,15 @@ def to_agent_engine(
|
||||
shutil.rmtree(agent_src_path)
|
||||
|
||||
try:
|
||||
ignore_patterns = None
|
||||
ae_ignore_path = os.path.join(agent_folder, '.ae_ignore')
|
||||
if os.path.exists(ae_ignore_path):
|
||||
click.echo(f'Ignoring files matching the patterns in {ae_ignore_path}')
|
||||
with open(ae_ignore_path, 'r') as f:
|
||||
patterns = [pattern.strip() for pattern in f.readlines()]
|
||||
ignore_patterns = shutil.ignore_patterns(*patterns)
|
||||
click.echo('Copying agent source code...')
|
||||
shutil.copytree(agent_folder, agent_src_path)
|
||||
shutil.copytree(agent_folder, agent_src_path, ignore=ignore_patterns)
|
||||
click.echo('Copying agent source code complete.')
|
||||
|
||||
click.echo('Initializing Vertex AI...')
|
||||
@@ -341,7 +348,7 @@ def to_agent_engine(
|
||||
env_vars = None
|
||||
if not env_file:
|
||||
# Attempt to read the env variables from .env in the dir (if any).
|
||||
env_file = os.path.join(agent_src_path, '.env')
|
||||
env_file = os.path.join(agent_folder, '.env')
|
||||
if os.path.exists(env_file):
|
||||
from dotenv import dotenv_values
|
||||
|
||||
|
||||
Reference in New Issue
Block a user