Skip to content

[air] Package code_source without git on PATH - #7625

Open
stevenchen-db wants to merge 2 commits into
mainfrom
schen/air-code-source-without-scm
Open

stevenchen-db wants to merge 2 commits into
mainfrom
schen/air-code-source-without-scm

Conversation

@stevenchen-db

Copy link
Copy Markdown
Contributor

Changes

databricks air run no longer needs git on PATH to package a code_source directory that isn't in a git repository.

  • Outside a repository, no git: the directory is packaged with libs/git's ignore rules (root and nested .gitignore, info/exclude, core.excludesFile). Symlinks are listed, not followed; a nested repository is one entry, as with git.
  • Inside a repository, or code_source.git set, no git: fails before validation, packaging, or any API call, with an actionable error.
  • git on PATH: the existing git-based listing is unchanged.
 $ PATH=<no git> databricks air run -f workload.yaml --dry-run    # code_source.root_path: . (not a repo)
-Error: failed to initialize temporary git metadata: exec: "git": executable file not found in $PATH:
+Dry run: code_source snapshot would include 2 file(s).

 $ PATH=<no git> databricks air run -f workload.yaml --dry-run    # code_source inside a git repo
-Error: failed to initialize temporary git metadata: exec: "git": executable file not found in $PATH:
+Error: code_source at /path/to/repo is in a git repository, so packaging it needs git on PATH; install git and retry

Known differences of the git-free listing (only used without git; pinned by tests): a root rule wins over a nested negation (*.log at the root excludes nested/keep.log even with !keep.log in nested/.gitignore), and include_paths globs use path.Match, where * doesn't cross /.

Why

Hosts without git (containers, CI images, agent sandboxes) couldn't use code_source at all, though git is only needed for its ignore rules outside a repository. The quickstart lists git as a requirement; a docs follow-up can narrow that to code inside a git repository.

No Jira ticket.

Tests

  • Unit: the git-free listing matches git ls-files for whole trees, directory and file include_paths, nested .gitignore, negation, ignored dirs, dotfiles and symlinks; nested repo as one entry; the two known differences; the early error for in-repo and pinned code (with an injected git lookup, also asserting no lookup without code_source).
  • Real workspace, no git on PATH: a code_source run succeeded and printed its output (run 892749685192587); the in-repo case failed with 0 API calls; a workload without code_source is unchanged. With git on PATH, the dry-run file count and request list match main.
  • TestAccept/air/ 20/20, lint clean, ./task checks passes. TestLogsCommandRepeatsRunLinkAfterStreaming fails the same way on main and is unrelated.

This pull request and its description were written by Isaac.

`air run` packaged every code_source with the git binary, so a host without git
failed with a raw exec error. A directory outside any repository now packages
without git: files come from libs/git's ignore rules, regular files and symlinks
are listed (symlinks not followed), and a nested repository is one "dir/" entry.
With git on PATH the git listing is unchanged.

Known differences of the git-free listing, only used without git:
- Rule precedence: the first matching rule from the root down wins, so a root
  "*.log" excludes nested/keep.log even with "!keep.log" in nested/.gitignore.
- include_paths globs use path.Match, where "*" does not cross "/".

A code_source inside a repository, or pinned with code_source.git, still needs
git. Without it, `air run` fails before config validation and packaging with an
actionable error.

Co-authored-by: Isaac <no-reply@databricks.com>
@stevenchen-db
stevenchen-db requested review from a team as code owners November 14, 2026 00:24
@github-actions github-actions Bot added the AIR Databricks AI Runtime CLI label Nov 14, 2026
Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: f74898f

Run: 43534193924

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 270 15 6:15
💚​ aws-windows-latest-4core-16gb 1 272 13 3:38
💚​ azure linux-2core-8gb 1 269 15 6:22
💚​ azure-windows-latest-4core-16gb 1 271 13 3:50
💚​ gcp linux-2core-8gb 1 270 15 7:56
💚​ gcp-windows-latest-4core-16gb 1 272 13 5:11
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 4 slowest tests (at least 2 minutes):
duration env testname
3:13 gcp-windows-latest-4core-16gb TestAccept
3:13 aws-windows-latest-4core-16gb TestAccept
2:44 azure-windows-latest-4core-16gb TestAccept
2:13 gcp linux-2core-8gb TestSyncIncrementalFileSync

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AIR Databricks AI Runtime CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants