fix(cli): Port deploy ignore-file handling to v1 - #6793
Merged
Conversation
`adk deploy cloud_run` and `adk deploy gke` copied the whole agent folder into the staging directory with no exclusions at all, so a `.env` holding a live API key was built into the container image and its registry layers even when the user's own `.gitignore` excluded it. `adk deploy agent_engine` filtered on `.ae_ignore` alone, and read it without stripping comments or normalizing trailing slashes. A single `_get_ignore_patterns_func` now unions the patterns from `.gitignore`, `.gcloudignore` and `.ae_ignore`, normalizes them for `fnmatch`, and feeds all three `copytree` calls. The local dev UI's `.adk` folder is excluded unconditionally, because the session database it holds grows large enough to fail a deployment. Nothing else is excluded on the user's behalf, so a `.git` directory is still copied unless an ignore file lists it. Ports commits ee79e71 ("respect ignore files in adk deploy commands", PR #4187) and dab351b ("Prevent adk deploy from uploading .adk/session.db") from main. The second of those writes `patterns = set('.adk/')`, which iterates the string into five one-character patterns, so `.adk` is not excluded on main either and a file named `d` is. This port writes `{'.adk'}`. Behaviour change: files matched by an ignore file are no longer deployed. A deployment that relied on a `.env` excluded by `.gitignore` reaching Cloud Run must now supply those values as environment variables or secrets on the target.
DeanChensj
approved these changes
Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports two commits from
main:fix(cli): respect ignore files in adk deploy commands(ee79e712)adk deploy cloud_run,gkeandagent_engineskip files matched by the agent folder's.gitignore,.gcloudignoreor.ae_ignore..ae_ignoreparsing drops blank and comment lines and strips a leading or trailing/, sovenv/and/venvmatch.fix: Prevent adk deploy from uploading .adk/session.db file(dab351be).adkfolder is excluded regardless of ignore-file contents, so local eval history stays out of a--with_uiimage.*.evalset.jsonfiles sit in the agent folder and are unaffected.A deployment that needs an ignored file on the target — usually a
.env— should supply those values as environment variables or secrets on the target instead.The
.adkexclusion is re-implemented rather than ported.