adk deploy ignores .gitignore patterns that start with **/

Ouverte
#8,294 1 commentaire 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 3 jours

@surajksharma07 y travaille déjà.

Depuis le 23/11/2026.

  • #8296 par @AshfaqueAhbab — ouverte

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
25/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
gcp, python
Domaine
cli

Piste de recherche

Start with _get_ignore_patterns_func in cli/cli_deploy.py, which passes the ignore patterns to shutil.ignore_patterns. Leading **/ patterns contain a slash and never match a bare file or folder name, so the stripping logic there needs to handle them. Check the gitignore-style cases listed in the issue, including the trailing slash in **/__pycache__/. Done means copying an agent folder with that function leaves out node_modules and __pycache__ directories. A linked pull request (#8296) is already open, so check it before starting.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

🔴 Required Information

Describe the Bug:
adk deploy reads .gitignore, .gcloudignore and .ae_ignore from the agent folder, but patterns with a leading **/ never match anything. Paths such as **/node_modules or **/__pycache__/ are common in these files, and the matching files and folders are still copied into the deployment.

_get_ignore_patterns_func in cli/cli_deploy.py passes the patterns to shutil.ignore_patterns, which compares them with file and folder names, not paths. **/node_modules contains a /, so it never equals a name. Root-anchored patterns such as /.venv already have their leading / stripped for the same reason.

Steps to Reproduce:

  1. In an agent folder, create node_modules/pkg/index.js, sub/__pycache__/x.pyc and a .gitignore with:
    **/node_modules
    **/__pycache__/
    
  2. Run adk deploy cloud_run (or agent_engine / gke), or copy the folder the way the deploy commands do:
    import shutil
    from google.adk.cli.cli_deploy import _get_ignore_patterns_func
    
    shutil.copytree("agent", "out", ignore=_get_ignore_patterns_func("agent"))
    
  3. Look at what was copied.

Expected Behavior:
node_modules and __pycache__ are left out, as they are by git and gcloud.

Observed Behavior:
Both are copied: out/node_modules/pkg/index.js and out/sub/__pycache__/x.pyc exist.

Environment Details:

  • ADK Library Version: 2.15.0 (main at 2b90353)
  • Desktop OS: Linux
  • Python Version: 3.12.13

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: N/A

🟡 Optional Information

Additional Context:
In .gitignore syntax, a leading **/ means "in any directory", which is what a plain name already matches, so stripping it gives the same result. Patterns with a / in the middle (like docs/build) also never match today, but I'd leave those alone, since approximating them could drop files the agent needs.

How often has this issue occurred?:

  • Always (100%)
Langage dominant
Python
Étoiles
22.3k
Forks
4.4k
Merge moyen
1 j 2 h
PR mergées (30 j)
6

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de google/adk-python

Toutes les issues de google/adk-python

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.