databricks-cli/libs
Pieter Noordhuis ab05f8e6e7
New YAML loader to support configuration location (#828)
## Changes

In order to support variable interpolation on fields that aren't a
string in the resource types, we need a separate representation of the
bundle configuration tree with the type equivalent of Go's `any`. But
instead of using `any` directly, we can do better and use a custom type
equivalent to `any` that captures additional metadata. In this PR, the
additional metadata is limited to the origin of the configuration value
(file, line number, and column).

The YAML in this commit uses the upstream YAML parser's `yaml.Node` type
to get access to location information. It reimplements the loader that
takes the `yaml.Node` structure and turns it into the configuration tree
we need.

Next steps after this PR:
* Implement configuration tree type checking (against a Go type)
* Implement configuration tree merging (to replace the current merge
functionality)
* Implement conversion to and from the bundle configuration struct
* Perform variable interpolation against this configuration tree (to
support variable interpolation for ints)
* (later) Implement a `jsonloader` that produces the same tree and
includes location information

## Tests

The tests in `yamlloader` perform an equality check on the untyped
output of loading a YAML file between the upstream YAML loader and this
loader. The YAML examples were generated by prompting ChatGPT for
examples that showcase anchors, primitive values, edge cases, etc.
2023-10-20 12:56:59 +00:00
..
auth Fix IsServicePrincipal() only working for workspace admins (#732) 2023-09-05 11:20:55 +00:00
cmdio Prompt once for a client profile (#727) 2023-09-11 15:32:24 +00:00
config New YAML loader to support configuration location (#828) 2023-10-20 12:56:59 +00:00
databrickscfg Always resolve .databrickscfg file (#659) 2023-08-14 12:45:08 +00:00
env Added `process.Background()` and `process.Forwarded()` (#804) 2023-09-27 09:04:44 +00:00
errs Added ability for deferred mutator execution (#380) 2023-05-16 18:01:50 +02:00
filer Update Go SDK to v0.19.0 (#729) 2023-09-05 09:43:57 +00:00
fileset Support .gitignore syntax in sync section and make sure it works recursively (#854) 2023-10-10 08:45:15 +00:00
flags Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
git Added `process.Background()` and `process.Forwarded()` (#804) 2023-09-27 09:04:44 +00:00
jsonschema Add support for validating CLI version when loading a jsonschema object (#883) 2023-10-19 14:01:48 +00:00
locker Correct name for force acquire deploy flag (#656) 2023-08-15 19:03:43 +00:00
log Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
notebook Error out if notebook file does not exist locally (#261) 2023-03-21 18:13:16 +01:00
process Added `process.Background()` and `process.Forwarded()` (#804) 2023-09-27 09:04:44 +00:00
python Added `python.DetectInterpreters` and other utils (#805) 2023-10-03 10:47:09 +00:00
set Added support for sync.include and sync.exclude sections (#671) 2023-08-18 08:07:25 +00:00
sync Support .gitignore syntax in sync section and make sure it works recursively (#854) 2023-10-10 08:45:15 +00:00
tags Library to validate and normalize cloud specific tags (#819) 2023-09-29 08:49:08 +00:00
template Improve the output of the `databricks bundle init` command (#795) 2023-10-19 07:08:36 +00:00
terraform Add bundle destroy command (#300) 2023-04-06 12:54:58 +02:00
testfile Refactor and cover edge cases in sync integration tests (#160) 2023-01-10 13:16:30 +01:00