Skip to content

Fix missing git info for bundles deployed from the new type of in-workspace Git folder#5709

Open
ilyakuz-db wants to merge 11 commits into
mainfrom
fix-git-info-new-git-folders
Open

Fix missing git info for bundles deployed from the new type of in-workspace Git folder#5709
ilyakuz-db wants to merge 11 commits into
mainfrom
fix-git-info-new-git-folders

Conversation

@ilyakuz-db

@ilyakuz-db ilyakuz-db commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Changes

The new type of in-workspace Git folder returns only id and path from get-status?return_git_info=true (no url/branch/commit), so bundles deployed from one recorded empty git provenance. Classic Repos and existing workspace Git folders return full git info inline and were not affected.

When the origin URL is missing but an id is present, the CLI now fetches url/branch/commit from Repos.GetByRepoId. Classic Repos skip the extra call. A failed lookup logs a warning and degrades to partial info instead of failing the deploy. (Reading on-disk .git is not an option: workspace Git folders don't expose a usable .git on the compute.)

Tests

libs/git/info_test.go: table-driven over all three folder types — classic Repo and workspace Git folder (inline info, Repos API not called), new git folder (id-only → recovered via Repos API), remoteless folder (branch/commit recovered, url stays empty), and Repos lookup failure (graceful degradation).

No acceptance test: the new folder type cannot be provisioned from the test harness (Repos-API-created Git folders don't appear on the serverless FUSE mount and git init cannot run on it), and local runs never take the DBR API path. The on-disk .git path is already covered by existing acceptance tests.

This PR was written by Claude Code.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/libs/git/ - needs approval

Files: libs/git/info.go, libs/git/info_test.go
Suggested: @simonfaltum
Also eligible: @Divyansh-db, @renaudhartert-db, @hectorcast-db, @parthban-db, @tanmay-db, @tejaskochar-db, @mihaimitrea-db, @chrisst, @rauchy

General files (require maintainer)

Files: NEXT_CHANGELOG.md
Based on git history:

  • @denik -- recent work in ./, libs/git/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

Co-authored-by: Isaac
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: ad956ca

Run: 28584258561

Env 🟨​KNOWN 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 7 3 13 230 1042 5:07
🟨​ aws windows 7 3 13 232 1040 6:56
💚​ aws-ucws linux 10 13 314 960 4:41
💚​ aws-ucws windows 10 13 316 958 3:49
💚​ azure linux 4 15 230 1041 3:58
💚​ azure windows 4 15 232 1039 4:00
💚​ azure-ucws linux 4 15 316 957 4:48
💚​ azure-ucws windows 4 15 318 955 3:53
💚​ gcp linux 4 15 229 1043 3:50
💚​ gcp windows 4 15 231 1041 3:32
23 interesting tests: 13 SKIP, 7 KNOWN, 3 RECOVERED
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/replace_existing 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/update_protected 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_projects/update_display_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/synced_database_tables/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 4 slowest tests (at least 2 minutes):
duration env testname
3:07 azure windows TestAccept
2:53 azure-ucws windows TestAccept
2:44 gcp windows TestAccept
2:40 aws-ucws windows TestAccept

Comment thread libs/git/info.go
result.CurrentBranch = gi.Branch
result.WorktreeRoot = fixedPath
} else {
if gi == nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens in the new Git folders case? Does the CLI successfully read GitInfo from the local .git? Can we add some acceptance test coverage for all three cases (new git, classic repo, and vanilla). You can mock the API endpoints.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On DBR this code never read locally, see this guard

if strings.HasPrefix(path, "/Workspace/") && dbr.RunsOnRuntime(ctx) {

That also make it harder to test with acceptance tests as we can't properly mock the environment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some unit tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With new git folders API returns only gitInfo.ID

See example

🔴 workspace/get-status doesn't return git provenance for git-in-data-plane folders

  Same repo (github.com/databricks/bundle-examples), same path, two workspaces — different
  result.

  ① AWS staging — git-in-DP folder (object_type: DIRECTORY)

  Request:
  GET /api/2.0/workspace/get-status
        ?path=/Workspace/Users/<user_name>/bundle-examples
        &return_git_info=true
  Response:
  {
    "object_type": "DIRECTORY",
    "git_info": {
      "id":   2884540697170475,
      "path": "/Users/<user_name>/bundle-examples"
    }
  }
  ❌ missing branch, head_commit_id, url, provider

  …yet the data does exist — same id, Repos API:
  GET /api/2.0/repos/2884540697170475
  {
    "branch":         "main",
    "head_commit_id": "d53214e177cd372afa03bfc044be9bb94103ba9a",
    "url":            "https://github.com/databricks/bundle-examples.git",
    "provider":       "gitHub"
  }
  ✅ full provenance

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There must be a way to read the commit ID? From the .git folders directly maybe as we do locally?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a followup to this PR - but capturing Git metadata from Git folders is an important usecase? Since DABs in the workspace is supported there?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a followup to this PR - but capturing Git metadata from Git folders is an important usecase? Since DABs in the workspace is supported there?

It's important — and this PR already covers it, so it doesn't need to be a followup. To clarify the scope:

  • This only affects bundles deployed from the workspace. Local and CI/CD deploys are unaffected — they read .git directly
  • We already supported two object types: classic Repos and Git folders. Both return the full git_info inline from Workspace get-status API, so they work correctly today
  • The gap is a new Private Preview feature, Git in Dataplane. Objects created with that flag don't return a full git_info from get-status — only git_info.id (the repo id) — and there's no .git directory to read on the Dataplane either
  • This PR handles that case: it takes the id and calls the Repos API (GET /api/2.0/repos/{id}) to recover branch/commit/url. So Git metadata ends up captured for all of them

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check if it's possible to add acceptance test using RunOnDbr

Verify bundle git provenance (origin_url, branch) is recorded when the
bundle lives in a Git folder. The provenance is read through two paths in
libs/git/info.go: locally from the on-disk .git directory, and on DBR
(RunsOnDbr) from the workspace get-status API by running the bundle from a
Git folder created with `repos create`. Both paths assert identical
output; commit is excluded as non-deterministic.
Make the API-path unit test table-driven and enumerate the three folder
types FetchRepositoryInfo can encounter: classic Repo and workspace Git
folder (full git info inline, no Repos API call) and git-in-dataplane
folder (id+path only, recovered via the Repos API), plus a remoteless
dataplane folder (branch/commit recovered, url stays empty) and graceful
degradation on a Repos lookup failure.
FetchRepositoryInfo contract says metadata-read errors are logged as
warnings, and the .git path already does so; at debug level a deploy that
records empty git provenance gives the user no clue why.
# Conflicts:
#	NEXT_CHANGELOG.md
#	internal/testarchive/ruff.go
Rename to bundle/git-info and assert environment-specific expectations
with constant output: locally the bundle root is a real git repo and full
provenance is recorded from .git; on DBR no git source can exist in the
bundle root (git cannot operate on the workspace FUSE mount, and
Repos-API-created Git folders do not materialize on it within the
session), so the get-status API path must degrade to empty provenance
without failing validate.
@ilyakuz-db ilyakuz-db temporarily deployed to test-trigger-is July 2, 2026 10:46 — with GitHub Actions Inactive
@ilyakuz-db ilyakuz-db temporarily deployed to test-trigger-is July 2, 2026 10:46 — with GitHub Actions Inactive
@ilyakuz-db ilyakuz-db changed the title Fix missing git info for bundles deployed from in-workspace Git folders Fix missing git info for bundles deployed from the new type of in-workspace Git folder Jul 2, 2026
Neither environment can exercise the id-only Repos-API fallback end to
end (Repos-API-created Git folders do not materialize on the serverless
FUSE mount, git cannot run on it, and local runs never take the DBR API
path), so the fallback is covered by unit tests in libs/git/info_test.go.
The on-disk .git path is already covered by existing acceptance tests.
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