databricks-cli/libs/template
Lennart Kats (databricks) a5b86093ec
Add a foundation for built-in templates (#685)
## Changes

This pull request extends the templating support in preparation of a
new, default template (WIP, https://github.com/databricks/cli/pull/686):
* builtin templates that can be initialized using e.g. `databricks
bundle init default-python`
* builtin templates are embedded into the executable using go's `embed`
functionality, making sure they're co-versioned with the CLI
* new helpers to get the workspace name, current user name, etc. help
craft a complete template
* (not enabled yet) when the user types `databricks bundle init` they
can interactively select the `default-python` template

And makes two tangentially related changes:
* IsServicePrincipal now uses the "users" API rather than the
"principals" API, since the latter is too slow for our purposes.
* mode: prod no longer requires the 'target.prod.git' setting. It's hard
to set that from a template. (Pieter is planning an overhaul of warnings
support; this would be one of the first warnings we show.)

The actual `default-python` template is maintained in a separate PR:
https://github.com/databricks/cli/pull/686

## Tests
Unit tests, manual testing
2023-08-25 09:03:42 +00:00
..
templates/default-python Add a foundation for built-in templates (#685) 2023-08-25 09:03:42 +00:00
testdata Add a foundation for built-in templates (#685) 2023-08-25 09:03:42 +00:00
config.go Use custom prompter for bundle template inputs (#663) 2023-08-15 14:50:20 +00:00
config_test.go Return better error messages for invalid JSON schema types in templates (#661) 2023-08-15 14:28:04 +00:00
file.go Only treat files with .tmpl extension as templates (#594) 2023-08-01 13:43:27 +00:00
file_test.go Only treat files with .tmpl extension as templates (#594) 2023-08-01 13:43:27 +00:00
helpers.go Add a foundation for built-in templates (#685) 2023-08-25 09:03:42 +00:00
helpers_test.go Add a foundation for built-in templates (#685) 2023-08-25 09:03:42 +00:00
materialize.go Add a foundation for built-in templates (#685) 2023-08-25 09:03:42 +00:00
renderer.go Add a foundation for built-in templates (#685) 2023-08-25 09:03:42 +00:00
renderer_test.go Add a foundation for built-in templates (#685) 2023-08-25 09:03:42 +00:00
utils.go Return better error messages for invalid JSON schema types in templates (#661) 2023-08-15 14:28:04 +00:00
utils_test.go Return better error messages for invalid JSON schema types in templates (#661) 2023-08-15 14:28:04 +00:00
validators.go Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
validators_test.go Add bundle init command and support for prompting user for input values (#631) 2023-08-07 13:14:25 +00:00