databricks-cli/internal
shreyas-goenka 2847533e1e
Add DABs support for Unity Catalog volumes (#1762)
## Changes

This PR adds support for UC volumes to DABs.

### Can I use a UC volume managed by DABs in `artifact_path`?

Yes, but we require the volume to exist before being referenced in
`artifact_path`. Otherwise you'll see an error that the volume does not
exist. For this case, this PR also adds a warning if we detect that the
UC volume is defined in the DAB itself, which informs the user to deploy
the UC volume in a separate deployment first before using it in
`artifact_path`.

We cannot create the UC volume and then upload the artifacts to it in
the same `bundle deploy` because `bundle deploy` always uploads the
artifacts to `artifact_path` before materializing any resources defined
in the bundle. Supporting this in a single deployment requires us to
migrate away from our dependency on the Databricks Terraform provider to
manage the CRUD lifecycle of DABs resources.

### Why do we not support `preset.name_prefix` for UC volumes?

UC volumes will not have a `dev_shreyas_goenka` prefix added in `mode:
development`. Configuring `presets.name_prefix` will be a no-op for UC
volumes. We have decided not to support prefixing for UC resources. This
is because:
1. UC provides its own namespace hierarchy that is independent of DABs.
2. Users can always manually use `${workspace.current_user.short_name}`
to configure the prefixes manually.

Customers often manually set up a UC hierarchy for dev and prod,
including a schema or catalog per developer. Thus, it's often
unnecessary for us to add prefixing in `mode: development` by default
for UC resources.

In retrospect, supporting prefixing for UC schemas and registered models
was a mistake and will be removed in a future release of DABs.

## Tests
Unit, integration test, and manually. 

### Manual Testing cases:
 1. UC volume does not exist:
```
➜  bundle-playground git:(master) ✗ cli bundle deploy
Error: failed to fetch metadata for the UC volume /Volumes/main/caps/my_volume that is configured in the artifact_path: Not Found
```

2. UC Volume does not exist, but is defined in the DAB
```
➜  bundle-playground git:(master) ✗ cli bundle deploy
Error: failed to fetch metadata for the UC volume /Volumes/main/caps/managed_by_dab that is configured in the artifact_path: Not Found

Warning: You might be using a UC volume in your artifact_path that is managed by this bundle but which has not been deployed yet. Please deploy the UC volume in a separate bundle deploy before using it in the artifact_path.
  at resources.volumes.bar
  in databricks.yml:24:7

```

---------

Co-authored-by: Pieter Noordhuis <pieter.noordhuis@databricks.com>
2024-12-02 21:18:07 +00:00
..
acc Encode assumptions about the dashboards API in a test (#1839) 2024-10-18 15:42:05 +00:00
bugbash Add script to make testing of code on branches easier (#1844) 2024-10-21 17:56:17 +00:00
build Assert SDK version is consistent in the CLI generation process (#1814) 2024-10-14 16:19:48 +00:00
bundle Add DABs support for Unity Catalog volumes (#1762) 2024-12-02 21:18:07 +00:00
mocks Use mockery to generate mocks compatible with testify/mock (#1190) 2024-02-08 15:18:53 +00:00
python Added test to submit and run various Python tasks on multiple DBR versions (#806) 2023-10-03 11:18:55 +00:00
testdata Add support for non-Python ipynb notebooks to DABs (#1827) 2024-11-13 21:39:51 +00:00
testjsons Update Go SDK to 0.23.0 and use custom marshaller (#772) 2023-10-16 06:56:06 +00:00
testutil Added support for creating all-purpose clusters (#1698) 2024-09-23 10:42:34 +00:00
alerts_test.go Fix integration tests after Go SDK bump (#1686) 2024-08-16 08:32:38 +00:00
api_test.go Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
auth_describe_test.go Fixed typo in error template for auth describe (#1341) 2024-04-08 11:19:13 +00:00
clusters_test.go Add usage string when command fails with incorrect arguments (#1276) 2024-03-12 14:12:34 +00:00
completer_test.go Add trailing slash to directory to produce completions for (#1666) 2024-08-12 07:07:50 +00:00
dashboard_assumptions_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
filer_test.go Fix workspace extensions filer accidentally reading notebooks (#1891) 2024-11-18 17:25:24 +00:00
fs_cat_test.go Add support for UC Volumes to the `databricks fs` commands (#1209) 2024-02-20 16:14:37 +00:00
fs_cp_test.go Add support for UC Volumes to the `databricks fs` commands (#1209) 2024-02-20 16:14:37 +00:00
fs_ls_test.go Add support for UC Volumes to the `databricks fs` commands (#1209) 2024-02-20 16:14:37 +00:00
fs_mkdir_test.go Fix `TestAccFsMkdirWhenFileExistsAtPath` in isolated Azure environments (#1833) 2024-10-16 12:50:17 +00:00
fs_rm_test.go Add support for UC Volumes to the `databricks fs` commands (#1209) 2024-02-20 16:14:37 +00:00
git_clone_test.go Remove resolution of repo names against the Databricks Github account (#940) 2023-11-01 13:02:06 +00:00
helpers.go Add support for non-Python ipynb notebooks to DABs (#1827) 2024-11-13 21:39:51 +00:00
init_test.go Fix `TestAccBundleInitOnMlopsStacks` (#1924) 2024-11-21 10:46:24 +00:00
jobs_test.go Update Go SDK to 0.23.0 and use custom marshaller (#772) 2023-10-16 06:56:06 +00:00
locker_test.go Bump github.com/databricks/databricks-sdk-go from 0.47.0 to 0.48.0 (#1810) 2024-10-07 13:21:05 +00:00
repos_test.go Bump github.com/databricks/databricks-sdk-go from 0.47.0 to 0.48.0 (#1810) 2024-10-07 13:21:05 +00:00
secrets_test.go Enabled incorrectly skipped tests (#1280) 2024-03-14 12:56:21 +00:00
storage_credentials_test.go Enabled incorrectly skipped tests (#1280) 2024-03-14 12:56:21 +00:00
sync_test.go Bump github.com/databricks/databricks-sdk-go from 0.47.0 to 0.48.0 (#1810) 2024-10-07 13:21:05 +00:00
tags_test.go Run tests to verify backend tag validation behavior (#814) 2023-09-29 08:38:06 +00:00
unknown_command_test.go Add regression tests for CLI error output (#1566) 2024-07-10 06:38:06 +00:00
version_test.go Use cmdio in version command for `--output` flag (#419) 2023-06-01 12:03:22 +02:00
workspace_test.go Print text logs in `import-dir` and `export-dir` commands (#1682) 2024-08-15 12:53:02 +00:00