databricks-cli/libs
shreyas-goenka bca9c2eda4
Add validation for files with a `.(resource-name).yml` extension (#1780)
## Changes
We want to encourage a pattern of specifying only a single resource in a
YAML file when the `.(resource-type).yml` extension is used (for
example, `.job.yml`). This convention could allow us to bijectively map
a resource YAML file to its corresponding resource in the Databricks
workspace.

This PR:
1. Emits a recommendation diagnostic when we detect this convention is
being violated. We can promote this to a warning when we want to
encourage this pattern more strongly.
2. Visualises the recommendation diagnostics in the `bundle validate`
command.

**NOTE:** While this PR also shows the recommendation for `.yaml` files,
we do not encourage users to use this extension. We only support it here
since it's part of the YAML standard and some existing users might
already be using `.yaml`.

## Tests
Unit tests and manually. Here's what an example output looks like:
```
Recommendation: define a single job in a file with the .job.yml extension.
  at resources.jobs.bar
     resources.jobs.foo
  in foo.job.yml:13:7
     foo.job.yml:5:7

The following resources are defined or configured in this file:
  - bar (job)
  - foo (job)
```

---------

Co-authored-by: Lennart Kats (databricks) <lennart.kats@databricks.com>
2024-10-07 09:16:20 +00:00
..
auth Use the friendly name of service principals when shortening their name (#1770) 2024-09-16 18:35:07 +00:00
cmdgroup Add trailing newline in usage string (#1382) 2024-04-19 14:12:52 +00:00
cmdio Print text logs in `import-dir` and `export-dir` commands (#1682) 2024-08-15 12:53:02 +00:00
databrickscfg Upgrade Go SDK to 0.44.0 (#1679) 2024-08-15 13:23:07 +00:00
diag Add validation for files with a `.(resource-name).yml` extension (#1780) 2024-10-07 09:16:20 +00:00
dyn Fixed generated YAML missing 'default' for empty values (#1765) 2024-09-11 09:49:58 +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
filer Use API mocks for duplicate path errors in workspace files extensions client (#1690) 2024-08-21 07:45:25 +00:00
fileset Make fileset take optional list of paths to list (#1684) 2024-08-19 15:15:14 +00:00
flags Add override to support YAML inputs for apps (#921) 2023-10-27 18:57:26 +00:00
folders Move folders package into libs (#1184) 2024-02-07 16:33:18 +00:00
git Assert tokens are redacted in origin URL when username is not specified (#1785) 2024-09-23 12:42:30 +00:00
jsonschema Make bundle JSON schema modular with `$defs` (#1700) 2024-09-10 13:55:18 +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 Let notebook detection code use underlying metadata if available (#1574) 2024-07-10 06:37:47 +00:00
process Use Go 1.22 to build and test (#1562) 2024-07-04 06:54:41 +00:00
python Make `pydabs/venv_path` optional (#1687) 2024-08-20 13:26:57 +00:00
set Added support for sync.include and sync.exclude sections (#671) 2023-08-18 08:07:25 +00:00
sync Add verbose flag to the "bundle deploy" command (#1774) 2024-09-23 10:09:11 +00:00
tags Library to validate and normalize cloud specific tags (#819) 2023-09-29 08:49:08 +00:00
template Always prepend bundle remote paths with /Workspace (#1724) 2024-10-02 15:34:00 +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