databricks-cli/bundle/config/mutator
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
..
paths Refactor jobs path translation (#1782) 2024-09-24 13:51:54 +00:00
python Rename `RootPath` -> `BundleRootPath` (#1792) 2024-09-27 10:03:05 +00:00
apply_presets.go Extended message for warning when source-linked mode is used outside of the workspace (#1929) 2024-11-22 14:44:33 +00:00
apply_presets_test.go Add DABs support for Unity Catalog volumes (#1762) 2024-12-02 21:18:07 +00:00
compute_id_compat.go Added support for creating all-purpose clusters (#1698) 2024-09-23 10:42:34 +00:00
compute_id_compate_test.go Added support for creating all-purpose clusters (#1698) 2024-09-23 10:42:34 +00:00
configure_dashboard_defaults.go Add support for AI/BI dashboards (#1743) 2024-10-29 09:11:08 +00:00
configure_dashboard_defaults_test.go Bump github.com/databricks/databricks-sdk-go from 0.49.0 to 0.51.0 (#1878) 2024-11-13 13:40:53 +00:00
configure_volume_defaults.go Add default value for `volume_type` for DABs (#1952) 2024-12-04 11:05:54 +00:00
configure_volume_defaults_test.go Add default value for `volume_type` for DABs (#1952) 2024-12-04 11:05:54 +00:00
configure_wsfs.go Extract functionality to detect if the CLI is running on DBR (#1889) 2024-11-14 16:10:45 +00:00
configure_wsfs_test.go Extract functionality to detect if the CLI is running on DBR (#1889) 2024-11-14 16:10:45 +00:00
default_queueing.go Enable job queueing by default (#1385) 2024-04-22 10:36:39 +00:00
default_queueing_test.go Fixed panic when loading incorrectly defined jobs (#1402) 2024-05-17 10:10:17 +00:00
default_target.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
default_target_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
default_workspace_paths.go Add resource path field to bundle workspace configuration (#1800) 2024-10-02 13:55:40 +00:00
default_workspace_paths_test.go Add resource path field to bundle workspace configuration (#1800) 2024-10-02 13:55:40 +00:00
default_workspace_root.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
default_workspace_root_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
environments_compat.go Compare `.Kind()` instead of direct equality checks on a `dyn.Value` (#1520) 2024-06-27 13:28:19 +00:00
environments_compat_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
expand_pipeline_glob_paths.go Track multiple locations associated with a `dyn.Value` (#1510) 2024-07-16 11:27:27 +00:00
expand_pipeline_glob_paths_test.go Rename `RootPath` -> `BundleRootPath` (#1792) 2024-09-27 10:03:05 +00:00
expand_workspace_root.go Always prepend bundle remote paths with /Workspace (#1724) 2024-10-02 15:34:00 +00:00
expand_workspace_root_test.go Always prepend bundle remote paths with /Workspace (#1724) 2024-10-02 15:34:00 +00:00
initialize_urls.go Add `bundle summary` to display URLs for deployed resources (#1731) 2024-10-18 06:45:47 +00:00
initialize_urls_test.go Make `TableName` field part of quality monitor schema (#1903) 2024-11-14 17:39:38 +00:00
initialize_variables.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
initialize_variables_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
initialize_workspace_client.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
load_git_details.go Properly read Git metadata when running inside workspace (#1945) 2024-12-05 10:13:13 +00:00
merge_job_clusters.go Compare `.Kind()` instead of direct equality checks on a `dyn.Value` (#1520) 2024-06-27 13:28:19 +00:00
merge_job_clusters_test.go Bump github.com/databricks/databricks-sdk-go from 0.36.0 to 0.37.0 (#1326) 2024-04-03 10:39:53 +00:00
merge_job_parameters.go Merge job parameters based on their name (#1659) 2024-08-06 16:12:18 +00:00
merge_job_parameters_test.go Merge job parameters based on their name (#1659) 2024-08-06 16:12:18 +00:00
merge_job_tasks.go Compare `.Kind()` instead of direct equality checks on a `dyn.Value` (#1520) 2024-06-27 13:28:19 +00:00
merge_job_tasks_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
merge_pipeline_clusters.go Compare `.Kind()` instead of direct equality checks on a `dyn.Value` (#1520) 2024-06-27 13:28:19 +00:00
merge_pipeline_clusters_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
mutator.go Move loadGitDetails mutator to Initialize phase (#1944) 2024-12-02 09:49:32 +00:00
noop.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
override_compute.go Added support for creating all-purpose clusters (#1698) 2024-09-23 10:42:34 +00:00
override_compute_test.go Added support for creating all-purpose clusters (#1698) 2024-09-23 10:42:34 +00:00
populate_current_user.go Move utility functions dealing with IAM to libs/iamutil (#1820) 2024-10-10 13:02:25 +00:00
populate_current_user_test.go Add short_name helper function to bundle init templates (#1167) 2024-02-01 16:46:07 +00:00
prepend_workspace_prefix.go Do not prepend paths starting with ~ or variable reference (#1905) 2024-11-15 15:03:59 +00:00
prepend_workspace_prefix_test.go Do not prepend paths starting with ~ or variable reference (#1905) 2024-11-15 15:03:59 +00:00
process_target_mode.go Source-linked deployments for bundles in the workspace (#1884) 2024-11-20 13:22:27 +01:00
process_target_mode_test.go Add DABs support for Unity Catalog volumes (#1762) 2024-12-02 21:18:07 +00:00
resolve_resource_references.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
resolve_resource_references_test.go Added listing cluster filtering for cluster lookups (#1754) 2024-09-06 11:34:57 +00:00
resolve_variable_references.go Do not suppress normalisation diagnostics for resolving variables (#1740) 2024-09-02 09:17:18 +00:00
resolve_variable_references_test.go Fixed resolving variable references inside slice variable (#1550) 2024-07-02 11:45:16 +00:00
rewrite_sync_paths.go Rename `RootPath` -> `BundleRootPath` (#1792) 2024-09-27 10:03:05 +00:00
rewrite_sync_paths_test.go Rename `RootPath` -> `BundleRootPath` (#1792) 2024-09-27 10:03:05 +00:00
rewrite_workspace_prefix.go Always prepend bundle remote paths with /Workspace (#1724) 2024-10-02 15:34:00 +00:00
rewrite_workspace_prefix_test.go Always prepend bundle remote paths with /Workspace (#1724) 2024-10-02 15:34:00 +00:00
run_as.go Add support for AI/BI dashboards (#1743) 2024-10-29 09:11:08 +00:00
run_as_test.go Add DABs support for Unity Catalog volumes (#1762) 2024-12-02 21:18:07 +00:00
select_default_target.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
select_default_target_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
select_target.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
select_target_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
set_variables.go Change SetVariables mutator to mutate dynamic configuration instead (#1573) 2024-07-09 11:12:42 +00:00
set_variables_test.go Change SetVariables mutator to mutate dynamic configuration instead (#1573) 2024-07-09 11:12:42 +00:00
sync_default_path.go Add paths field to bundle sync configuration (#1694) 2024-08-21 15:33:25 +00:00
sync_default_path_test.go Rename `RootPath` -> `BundleRootPath` (#1792) 2024-09-27 10:03:05 +00:00
sync_infer_root.go Rename `RootPath` -> `BundleRootPath` (#1792) 2024-09-27 10:03:05 +00:00
sync_infer_root_internal_test.go Add paths field to bundle sync configuration (#1694) 2024-08-21 15:33:25 +00:00
sync_infer_root_test.go Rename `RootPath` -> `BundleRootPath` (#1792) 2024-09-27 10:03:05 +00:00
translate_paths.go Extend "notebook not found" error to warn about missing extension (#1920) 2024-11-21 16:21:21 +05:30
translate_paths_artifacts.go Add context type and value to path rewriting (#1525) 2024-06-25 10:04:22 +00:00
translate_paths_dashboards.go Add support for AI/BI dashboards (#1743) 2024-10-29 09:11:08 +00:00
translate_paths_dashboards_test.go Bump github.com/databricks/databricks-sdk-go from 0.49.0 to 0.51.0 (#1878) 2024-11-13 13:40:53 +00:00
translate_paths_jobs.go Refactor jobs path translation (#1782) 2024-09-24 13:51:54 +00:00
translate_paths_pipelines.go Add context type and value to path rewriting (#1525) 2024-06-25 10:04:22 +00:00
translate_paths_test.go Extend "notebook not found" error to warn about missing extension (#1920) 2024-11-21 16:21:21 +05:30
validate_git_details.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
validate_git_details_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
verify_cli_version.go Ignore CLI version check on development builds of the CLI (#1714) 2024-08-23 10:13:21 +00:00
verify_cli_version_test.go Ignore CLI version check on development builds of the CLI (#1714) 2024-08-23 10:13:21 +00:00