libs/git: read git metadata from Repos API for DABs in the workspace - #6296
Draft
shreyas-goenka wants to merge 1 commit into
Draft
libs/git: read git metadata from Repos API for DABs in the workspace#6296shreyas-goenka wants to merge 1 commit into
shreyas-goenka wants to merge 1 commit into
Conversation
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
Collaborator
Integration test reportCommit: 00e953e
8 interesting tests: 4 RECOVERED, 4 SKIP
Top 6 slowest tests (at least 2 minutes):
|
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.
Problem
databricks bundlecommands running inside a Databricks workspace (on DBR, bundle root under/Workspace/) read the bundle's git branch/commit/origin from:For git-in-data-plane folders (
object_type: DIRECTORY), this response returns agit_infowith onlyidandpath—branch,head_commit_id, andurlare 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 thegit_infometadata 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 fullbranch/head_commit_id/urlfor the same folder.Result: bundles in such folders get empty
bundle.git.branch/commit/origin_url. This also fails the integration testTestFetchRepositoryInfoAPI_FromRepoacross AWS + Azure test workspaces (it passes on dogfood, which still serves classic Repos inline).Fix
Use
get-statusonly to resolve the input path to its enclosing git folder (id+ root path — both still returned reliably, including for subdirectories), then readbranch/head_commit_id/urlfrom the Repos API by id (Repos.GetByRepoId), which is authoritative for both git-in-DP folders and classic Repos.WorktreeRootis still resolved fromget-statusand 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.gowith a mock-server regression test:get-statusreturns onlyid+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 testTestFetchRepositoryInfoAPI_FromReporemains the live-workspace guard and should now pass on the affected test envs.This pull request and its description were written by Isaac.