Skip to content

fix(cli): Port deploy ignore-file handling to v1 - #6793

Merged
GWeale merged 1 commit into
v1from
backport-v1-pr22
Aug 19, 2026
Merged

fix(cli): Port deploy ignore-file handling to v1#6793
GWeale merged 1 commit into
v1from
backport-v1-pr22

Conversation

@GWeale

@GWeale GWeale commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Ports two commits from main:

  1. fix(cli): respect ignore files in adk deploy commands (ee79e712)

    • adk deploy cloud_run, gke and agent_engine skip files matched by the agent folder's .gitignore, .gcloudignore or .ae_ignore.
    • .ae_ignore parsing drops blank and comment lines and strips a leading or trailing /, so venv/ and /venv match.
    • An unreadable ignore file warns and the deploy continues.
  2. fix: Prevent adk deploy from uploading .adk/session.db file (dab351be)

    • The dev UI's .adk folder is excluded regardless of ignore-file contents, so local eval history stays out of a --with_ui image. *.evalset.json files 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 .adk exclusion is re-implemented rather than ported.

`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.
@GWeale
GWeale merged commit 8467bf0 into v1 Aug 19, 2026
14 checks passed
@GWeale
GWeale deleted the backport-v1-pr22 branch August 20, 2026 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants