databricks-cli/cmd
Denis Bilenko 0ad790e468
Properly read Git metadata when running inside workspace (#1945)
## Changes

Since there is no .git directory in Workspace file system, we need to
make an API call to api/2.0/workspace/get-status?return_git_info=true to
fetch git the root of the repo, current branch, commit and origin.

Added new function FetchRepositoryInfo that either looks up and parses
.git or calls remote API depending on env.

Refactor Repository/View/FileSet to accept repository root rather than
calculate it. This helps because:
- Repository is currently created in multiple places and finding the
repository root is becoming relatively expensive (API call needed).
- Repository/FileSet/View do not have access to current Bundle which is
where WorkplaceClient is stored.

## Tests

- Tested manually by running "bundle validate --json" inside web
terminal within Databricks env.
- Added integration tests for the new API.

---------

Co-authored-by: Andrew Nester <andrew.nester@databricks.com>
Co-authored-by: Pieter Noordhuis <pieter.noordhuis@databricks.com>
2024-12-05 10:13:13 +00:00
..
account Bump github.com/databricks/databricks-sdk-go from 0.51.0 to 0.52.0 (#1931) 2024-11-28 15:33:51 +00:00
api Added JSON input validation for CLI commands (#1771) 2024-10-11 14:39:53 +00:00
auth Do not error if we cannot prompt for a profile in `auth login` (#1745) 2024-09-04 07:14:21 +00:00
bundle Update filenames used by bundle generate to use `.<resource-type>.yml` (#1901) 2024-11-20 13:53:25 +01:00
configure Fix `databricks configure` to use DATABRICKS_CONFIG_FILE environment variable if exists as config file (#1325) 2024-06-24 10:56:49 +00:00
fs Consolidate test helpers for `io/fs` (#1906) 2024-11-15 15:37:21 +00:00
labs Upgrade Go SDK to 0.44.0 (#1679) 2024-08-15 13:23:07 +00:00
root Extract functionality to detect if the CLI is running on DBR (#1889) 2024-11-14 16:10:45 +00:00
sync Properly read Git metadata when running inside workspace (#1945) 2024-12-05 10:13:13 +00:00
version Add usage string when command fails with incorrect arguments (#1276) 2024-03-12 14:12:34 +00:00
workspace Bump github.com/databricks/databricks-sdk-go from 0.51.0 to 0.52.0 (#1931) 2024-11-28 15:33:51 +00:00
cmd.go Upgrade Go SDK to 0.44.0 (#1679) 2024-08-15 13:23:07 +00:00