databricks-cli/cmd
shreyas-goenka 7beb0fb8b5
Add validation mutator for volume `artifact_path` (#2050)
## Changes
This PR:
1. Incrementally improves the error messages shown to the user when the
volume they are referring to in `workspace.artifact_path` does not
exist.
2. Performs this validation in both `bundle validate` and `bundle
deploy` compared to before on just deployments.
3. It runs "fast" validations on `bundle deploy`, which earlier were
only run on `bundle validate`.


## Tests
Unit tests and manually. Also, existing integration tests provide
coverage (`TestUploadArtifactToVolumeNotYetDeployed`,
`TestUploadArtifactFileToVolumeThatDoesNotExist`)

Examples:
```
.venv➜  bundle-playground git:(master) ✗ cli bundle validate
Error: cannot access volume capital.whatever.my_volume: User does not have READ VOLUME on Volume 'capital.whatever.my_volume'.
  at workspace.artifact_path
  in databricks.yml:7:18
```

and

```
.venv➜  bundle-playground git:(master) ✗ cli bundle validate
Error: volume capital.whatever.foobar does not exist
  at workspace.artifact_path
     resources.volumes.foo
  in databricks.yml:7:18
     databricks.yml:12:7

You are using a volume in your artifact_path that is managed by
this bundle but which has not been deployed yet. Please first deploy
the volume using 'bundle deploy' and then switch over to using it in
the artifact_path.
```
2025-01-02 17:23:15 +05:30
..
account Upgrade Go SDK to 0.54.0 (#2029) 2024-12-18 12:43:27 +00:00
api Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
auth Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
bundle Add validation mutator for volume `artifact_path` (#2050) 2025-01-02 17:23:15 +05:30
configure Enable testifylint and fix the issues (#2065) 2025-01-02 12:03:41 +01:00
fs Consolidate test helpers for `io/fs` (#1906) 2024-11-15 15:37:21 +00:00
labs Enable testifylint and fix the issues (#2065) 2025-01-02 12:03:41 +01:00
root Remove calls to `t.Setenv` from integration tests (#2018) 2024-12-16 12:34:37 +01:00
sync Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
version Add usage string when command fails with incorrect arguments (#1276) 2024-03-12 14:12:34 +00:00
workspace Upgrade Go SDK to 0.54.0 (#2029) 2024-12-18 12:43:27 +00:00
cmd.go Upgrade Go SDK to 0.44.0 (#1679) 2024-08-15 13:23:07 +00:00