databricks-cli/libs
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
..
auth Clean host URL in the `auth login` command (#1879) 2024-11-05 15:29:27 +00:00
cmdgroup Add trailing newline in usage string (#1382) 2024-04-19 14:12:52 +00:00
cmdio Added JSON input validation for CLI commands (#1771) 2024-10-11 14:39:53 +00:00
databrickscfg Upgrade Go SDK to 0.44.0 (#1679) 2024-08-15 13:23:07 +00:00
dbr Extract functionality to detect if the CLI is running on DBR (#1889) 2024-11-14 16:10:45 +00:00
diag Properly read Git metadata when running inside workspace (#1945) 2024-12-05 10:13:13 +00:00
dyn Add DABs support for Unity Catalog volumes (#1762) 2024-12-02 21:18:07 +00:00
env Fix `panic: $HOME is not set` (#1027) 2023-11-29 19:08:27 +00:00
errs Added ability for deferred mutator execution (#380) 2023-05-16 18:01:50 +02:00
exec Fixed building Python artifacts on Windows with WSL (#1249) 2024-03-01 15:59:47 +00:00
fakefs Consolidate test helpers for `io/fs` (#1906) 2024-11-15 15:37:21 +00:00
filer Add DABs support for Unity Catalog volumes (#1762) 2024-12-02 21:18:07 +00:00
fileset Make fileset take optional list of paths to list (#1684) 2024-08-19 15:15:14 +00:00
flags Fixed unmarshalling json input into `interface{}` type (#1832) 2024-10-15 12:10:02 +00:00
folders Move folders package into libs (#1184) 2024-02-07 16:33:18 +00:00
git Properly read Git metadata when running inside workspace (#1945) 2024-12-05 10:13:13 +00:00
iamutil Move utility functions dealing with IAM to libs/iamutil (#1820) 2024-10-10 13:02:25 +00:00
jsonschema Use `fs.FS` interface to read template (#1910) 2024-11-20 09:28:35 +00:00
locker Correct name for force acquire deploy flag (#656) 2023-08-15 19:03:43 +00:00
log Rewrite the friendly log handler (#1038) 2023-12-01 12:17:04 +00:00
notebook Consolidate test helpers for `io/fs` (#1906) 2024-11-15 15:37:21 +00:00
process Attempt to reduce test flakiness on Windows (#1845) 2024-10-24 12:03:12 +00:00
python Make `pydabs/venv_path` optional (#1687) 2024-08-20 13:26:57 +00:00
set Show actionable errors for collaborative deployment scenarios (#1386) 2024-10-10 11:18:23 +00:00
sync Properly read Git metadata when running inside workspace (#1945) 2024-12-05 10:13:13 +00:00
tags Library to validate and normalize cloud specific tags (#819) 2023-09-29 08:49:08 +00:00
template Add comment for why we test two files for `bundle_uuid` (#1949) 2024-12-02 14:40:57 +00:00
terraform Move to a single prompt during bundle destroy (#1583) 2024-07-24 13:02:19 +00:00
testfile Refactor and cover edge cases in sync integration tests (#160) 2023-01-10 13:16:30 +01:00
textutil Fixed job name normalisation for bundle generate (#1601) 2024-07-17 12:33:49 +00:00
vfs Replace `vfs.Path` with extension-aware filer when running on DBR (#1556) 2024-07-03 11:55:42 +00:00