Skip to content

libs/git: read git metadata from Repos API for DABs in the workspace - #6296

Draft
shreyas-goenka wants to merge 1 commit into
mainfrom
shreyas-goenka/git-info-from-repos-api
Draft

libs/git: read git metadata from Repos API for DABs in the workspace#6296
shreyas-goenka wants to merge 1 commit into
mainfrom
shreyas-goenka/git-info-from-repos-api

Conversation

@shreyas-goenka

Copy link
Copy Markdown
Contributor

Problem

databricks bundle commands running inside a Databricks workspace (on DBR, bundle root under /Workspace/) read the bundle's git branch/commit/origin from:

GET /api/2.0/workspace/get-status?path=...&return_git_info=true

For git-in-data-plane folders (object_type: DIRECTORY), this response returns a git_info with only id and pathbranch, head_commit_id, and url are missing. Only classic Repos (object_type: REPO) still return them inline. The Repos team has confirmed they do not store git attributes for git-in-DP folders and are deprecating the git_info metadata fields on the workspace API; the Repos API should be called for git metadata instead.

The data itself exists — GET /api/2.0/repos/{id} returns full branch/head_commit_id/url for the same folder.

Result: bundles in such folders get empty bundle.git.branch / commit / origin_url. This also fails the integration test TestFetchRepositoryInfoAPI_FromRepo across AWS + Azure test workspaces (it passes on dogfood, which still serves classic Repos inline).

Fix

Use get-status only to resolve the input path to its enclosing git folder (id + root path — both still returned reliably, including for subdirectories), then read branch/head_commit_id/url from the Repos API by id (Repos.GetByRepoId), which is authoritative for both git-in-DP folders and classic Repos.

WorktreeRoot is still resolved from get-status and the best-effort contract is unchanged: if the Repos lookup fails, the worktree root is still returned and a warning is logged.

Test

Added libs/git/info_test.go with a mock-server regression test: get-status returns only id+path, and the CLI recovers full git metadata via the Repos API. A second case covers a non-git-folder path (empty result, no Repos call). The existing integration test TestFetchRepositoryInfoAPI_FromRepo remains the live-workspace guard and should now pass on the affected test envs.

This pull request and its description were written by Isaac.

get-status with return_git_info=true no longer returns branch/head_commit_id/url
for git-in-data-plane folders (only classic Repos return them inline), and those
fields are being deprecated on the workspace API. Bundles running inside such a
folder were left with empty git branch/commit/origin.

Use get-status only to resolve the input path to its enclosing git folder (id +
root path), then read branch/commit/url from the Repos API by id, which is
authoritative for both git-in-DP folders and classic Repos.

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

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 00e953e

Run: 32080646757

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 286 1150 5:09
💚​ aws windows 4 4 288 1148 7:05
💚​ azure linux 4 4 285 1150 5:10
💚​ azure windows 4 4 287 1148 5:46
💚​ gcp linux 1 5 286 1150 5:15
💚​ gcp windows 1 5 288 1148 5:42
8 interesting tests: 4 RECOVERED, 4 SKIP
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R
Top 6 slowest tests (at least 2 minutes):
duration env testname
6:56 aws windows TestAccept
5:38 azure windows TestAccept
5:34 gcp windows TestAccept
3:50 azure linux TestAccept
3:46 aws linux TestAccept
3:45 gcp linux TestAccept

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.

2 participants