feat: Add styles

This commit is contained in:
Ilya Kuznetsov 2024-12-10 13:44:20 +01:00
parent b076813e38
commit 073aeca5b7
No known key found for this signature in database
GPG Key ID: 91F3DDCF5D21CDDF
3 changed files with 415 additions and 272 deletions

View File

@ -7,6 +7,7 @@ import (
"strings" "strings"
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
yaml3 "gopkg.in/yaml.v3"
"github.com/databricks/cli/libs/dyn" "github.com/databricks/cli/libs/dyn"
"github.com/databricks/cli/libs/dyn/convert" "github.com/databricks/cli/libs/dyn/convert"
@ -104,12 +105,12 @@ func (d *annotationHandler) addAnnotations(typ reflect.Type, s jsonschema.Schema
// Adds empty annotations with placeholders to the annotation file // Adds empty annotations with placeholders to the annotation file
func (d *annotationHandler) sync(outputPath string) error { func (d *annotationHandler) sync(outputPath string) error {
file, err := os.ReadFile(outputPath) existingFile, err := os.ReadFile(outputPath)
if err != nil { if err != nil {
return err return err
} }
existing, err := yamlloader.LoadYAML(outputPath, bytes.NewBuffer(file)) existing, err := yamlloader.LoadYAML(outputPath, bytes.NewBuffer(existingFile))
if err != nil { if err != nil {
return err return err
} }
@ -127,9 +128,14 @@ func (d *annotationHandler) sync(outputPath string) error {
return err return err
} }
saver := yamlsaver.NewSaver() style := map[string]yaml3.Style{}
config, _ := mergedFile.AsMap() file, _ := mergedFile.AsMap()
err = saver.SaveAsYAML(config, outputPath, true) for _, v := range file.Keys() {
style[v.MustString()] = yaml3.LiteralStyle
}
saver := yamlsaver.NewSaverWithStyle(style)
err = saver.SaveAsYAML(file, outputPath, true)
if err != nil { if err != nil {
return err return err
} }

View File

@ -1,289 +1,426 @@
github.com/databricks/cli/bundle/config.Artifact: github.com/databricks/cli/bundle/config.Artifact:
build: "build":
description: An optional set of non-default build commands that you want to run locally before deployment. For Python wheel builds, the Databricks CLI assumes that it can find a local install of the Python wheel package to run builds, and it runs the command python setup.py bdist_wheel by default during each bundle deployment. To specify multiple build commands, separate each command with double-ampersand (&&) characters. "description": |-
executable: An optional set of non-default build commands that you want to run locally before deployment.
description: PLACEHOLDER
files: For Python wheel builds, the Databricks CLI assumes that it can find a local install of the Python wheel package to run builds, and it runs the command python setup.py bdist_wheel by default during each bundle deployment.
description: PLACEHOLDER
path: To specify multiple build commands, separate each command with double-ampersand (&&) characters.
description: PLACEHOLDER "executable":
type: "description": |-
description: PLACEHOLDER PLACEHOLDER
"files":
"description": |-
PLACEHOLDER
"path":
"description": |-
PLACEHOLDER
"type":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.ArtifactFile: github.com/databricks/cli/bundle/config.ArtifactFile:
source: "source":
description: PLACEHOLDER "description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.Bundle: github.com/databricks/cli/bundle/config.Bundle:
cluster_id: "cluster_id":
description: PLACEHOLDER "description": |-
compute_id: PLACEHOLDER
description: PLACEHOLDER "compute_id":
databricks_cli_version: "description": |-
description: PLACEHOLDER PLACEHOLDER
deployment: "databricks_cli_version":
description: PLACEHOLDER "description": |-
git: PLACEHOLDER
description: PLACEHOLDER "deployment":
name: "description": |-
description: PLACEHOLDER PLACEHOLDER
uuid: "git":
description: PLACEHOLDER "description": |-
PLACEHOLDER
"name":
"description": |-
PLACEHOLDER
"uuid":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.Deployment: github.com/databricks/cli/bundle/config.Deployment:
fail_on_active_runs: "fail_on_active_runs":
description: PLACEHOLDER "description": |-
lock: PLACEHOLDER
description: PLACEHOLDER "lock":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.Experimental: github.com/databricks/cli/bundle/config.Experimental:
pydabs: "pydabs":
description: PLACEHOLDER "description": |-
python_wheel_wrapper: PLACEHOLDER
description: PLACEHOLDER "python_wheel_wrapper":
scripts: "description": |-
description: PLACEHOLDER PLACEHOLDER
use_legacy_run_as: "scripts":
description: PLACEHOLDER "description": |-
PLACEHOLDER
"use_legacy_run_as":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.Git: github.com/databricks/cli/bundle/config.Git:
branch: "branch":
description: PLACEHOLDER "description": |-
origin_url: PLACEHOLDER
description: PLACEHOLDER "origin_url":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.Lock: github.com/databricks/cli/bundle/config.Lock:
enabled: "enabled":
description: PLACEHOLDER "description": |-
force: PLACEHOLDER
description: PLACEHOLDER "force":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.Presets: github.com/databricks/cli/bundle/config.Presets:
jobs_max_concurrent_runs: "jobs_max_concurrent_runs":
description: PLACEHOLDER "description": |-
name_prefix: PLACEHOLDER
description: PLACEHOLDER "name_prefix":
pipelines_development: "description": |-
description: PLACEHOLDER PLACEHOLDER
source_linked_deployment: "pipelines_development":
description: PLACEHOLDER "description": |-
tags: PLACEHOLDER
description: PLACEHOLDER "source_linked_deployment":
trigger_pause_status: "description": |-
description: PLACEHOLDER PLACEHOLDER
"tags":
"description": |-
PLACEHOLDER
"trigger_pause_status":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.PyDABs: github.com/databricks/cli/bundle/config.PyDABs:
enabled: "enabled":
description: PLACEHOLDER "description": |-
import: PLACEHOLDER
description: PLACEHOLDER "import":
venv_path: "description": |-
description: PLACEHOLDER PLACEHOLDER
"venv_path":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.Resources: github.com/databricks/cli/bundle/config.Resources:
clusters: "clusters":
description: PLACEHOLDER "description": |-
dashboards: PLACEHOLDER
description: PLACEHOLDER "dashboards":
experiments: "description": |-
description: PLACEHOLDER PLACEHOLDER
jobs: "experiments":
description: PLACEHOLDER "description": |-
model_serving_endpoints: PLACEHOLDER
description: PLACEHOLDER "jobs":
models: "description": |-
description: PLACEHOLDER PLACEHOLDER
pipelines: "model_serving_endpoints":
description: PLACEHOLDER "description": |-
quality_monitors: PLACEHOLDER
description: PLACEHOLDER "models":
registered_models: "description": |-
description: PLACEHOLDER PLACEHOLDER
schemas: "pipelines":
description: PLACEHOLDER "description": |-
volumes: PLACEHOLDER
description: PLACEHOLDER "quality_monitors":
"description": |-
PLACEHOLDER
"registered_models":
"description": |-
PLACEHOLDER
"schemas":
"description": |-
PLACEHOLDER
"volumes":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.Root: github.com/databricks/cli/bundle/config.Root:
artifacts: "artifacts":
description: Defines the attributes to build an artifact "description": |-
bundle: Defines the attributes to build an artifact
description: PLACEHOLDER "bundle":
experimental: "description": |-
description: PLACEHOLDER PLACEHOLDER
include: "experimental":
description: PLACEHOLDER "description": |-
permissions: PLACEHOLDER
description: PLACEHOLDER "include":
presets: "description": |-
description: PLACEHOLDER PLACEHOLDER
resources: "permissions":
description: PLACEHOLDER "description": |-
run_as: PLACEHOLDER
description: PLACEHOLDER "presets":
sync: "description": |-
description: PLACEHOLDER PLACEHOLDER
targets: "resources":
description: PLACEHOLDER "description": |-
variables: PLACEHOLDER
description: PLACEHOLDER "run_as":
workspace: "description": |-
description: PLACEHOLDER PLACEHOLDER
"sync":
"description": |-
PLACEHOLDER
"targets":
"description": |-
PLACEHOLDER
"variables":
"description": |-
PLACEHOLDER
"workspace":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.Sync: github.com/databricks/cli/bundle/config.Sync:
exclude: "exclude":
description: PLACEHOLDER "description": |-
include: PLACEHOLDER
description: PLACEHOLDER "include":
paths: "description": |-
description: PLACEHOLDER PLACEHOLDER
"paths":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.Target: github.com/databricks/cli/bundle/config.Target:
artifacts: "artifacts":
description: PLACEHOLDER "description": |-
bundle: PLACEHOLDER
description: PLACEHOLDER "bundle":
cluster_id: "description": |-
description: PLACEHOLDER PLACEHOLDER
compute_id: "cluster_id":
description: PLACEHOLDER "description": |-
default: PLACEHOLDER
description: PLACEHOLDER "compute_id":
git: "description": |-
description: PLACEHOLDER PLACEHOLDER
mode: "default":
description: PLACEHOLDER "description": |-
permissions: PLACEHOLDER
description: PLACEHOLDER "git":
presets: "description": |-
description: PLACEHOLDER PLACEHOLDER
resources: "mode":
description: PLACEHOLDER "description": |-
run_as: PLACEHOLDER
description: PLACEHOLDER "permissions":
sync: "description": |-
description: PLACEHOLDER PLACEHOLDER
variables: "presets":
description: PLACEHOLDER "description": |-
workspace: PLACEHOLDER
description: PLACEHOLDER "resources":
"description": |-
PLACEHOLDER
"run_as":
"description": |-
PLACEHOLDER
"sync":
"description": |-
PLACEHOLDER
"variables":
"description": |-
PLACEHOLDER
"workspace":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config.Workspace: github.com/databricks/cli/bundle/config.Workspace:
artifact_path: "artifact_path":
description: PLACEHOLDER "description": |-
auth_type: PLACEHOLDER
description: PLACEHOLDER "auth_type":
azure_client_id: "description": |-
description: PLACEHOLDER PLACEHOLDER
azure_environment: "azure_client_id":
description: PLACEHOLDER "description": |-
azure_login_app_id: PLACEHOLDER
description: PLACEHOLDER "azure_environment":
azure_tenant_id: "description": |-
description: PLACEHOLDER PLACEHOLDER
azure_use_msi: "azure_login_app_id":
description: PLACEHOLDER "description": |-
azure_workspace_resource_id: PLACEHOLDER
description: PLACEHOLDER "azure_tenant_id":
client_id: "description": |-
description: PLACEHOLDER PLACEHOLDER
file_path: "azure_use_msi":
description: PLACEHOLDER "description": |-
google_service_account: PLACEHOLDER
description: PLACEHOLDER "azure_workspace_resource_id":
host: "description": |-
description: PLACEHOLDER PLACEHOLDER
profile: "client_id":
description: PLACEHOLDER "description": |-
resource_path: PLACEHOLDER
description: PLACEHOLDER "file_path":
root_path: "description": |-
description: PLACEHOLDER PLACEHOLDER
state_path: "google_service_account":
description: PLACEHOLDER "description": |-
PLACEHOLDER
"host":
"description": |-
PLACEHOLDER
"profile":
"description": |-
PLACEHOLDER
"resource_path":
"description": |-
PLACEHOLDER
"root_path":
"description": |-
PLACEHOLDER
"state_path":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config/resources.Grant: github.com/databricks/cli/bundle/config/resources.Grant:
principal: "principal":
description: PLACEHOLDER "description": |-
privileges: PLACEHOLDER
description: PLACEHOLDER "privileges":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config/resources.Permission: github.com/databricks/cli/bundle/config/resources.Permission:
group_name: "group_name":
description: PLACEHOLDER "description": |-
level: PLACEHOLDER
description: PLACEHOLDER "level":
service_principal_name: "description": |-
description: PLACEHOLDER PLACEHOLDER
user_name: "service_principal_name":
description: PLACEHOLDER "description": |-
PLACEHOLDER
"user_name":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config/variable.Lookup: github.com/databricks/cli/bundle/config/variable.Lookup:
alert: "alert":
description: PLACEHOLDER "description": |-
cluster: PLACEHOLDER
description: PLACEHOLDER "cluster":
cluster_policy: "description": |-
description: PLACEHOLDER PLACEHOLDER
dashboard: "cluster_policy":
description: PLACEHOLDER "description": |-
instance_pool: PLACEHOLDER
description: PLACEHOLDER "dashboard":
job: "description": |-
description: PLACEHOLDER PLACEHOLDER
metastore: "instance_pool":
description: PLACEHOLDER "description": |-
notification_destination: PLACEHOLDER
description: PLACEHOLDER "job":
pipeline: "description": |-
description: PLACEHOLDER PLACEHOLDER
query: "metastore":
description: PLACEHOLDER "description": |-
service_principal: PLACEHOLDER
description: PLACEHOLDER "notification_destination":
warehouse: "description": |-
description: PLACEHOLDER PLACEHOLDER
"pipeline":
"description": |-
PLACEHOLDER
"query":
"description": |-
PLACEHOLDER
"service_principal":
"description": |-
PLACEHOLDER
"warehouse":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config/variable.TargetVariable: github.com/databricks/cli/bundle/config/variable.TargetVariable:
default: "default":
description: PLACEHOLDER "description": |-
description: PLACEHOLDER
description: PLACEHOLDER "description":
lookup: "description": |-
description: PLACEHOLDER PLACEHOLDER
type: "lookup":
description: PLACEHOLDER "description": |-
PLACEHOLDER
"type":
"description": |-
PLACEHOLDER
github.com/databricks/cli/bundle/config/variable.Variable: github.com/databricks/cli/bundle/config/variable.Variable:
default: "default":
description: PLACEHOLDER "description": |-
description: PLACEHOLDER
description: PLACEHOLDER "description":
lookup: "description": |-
description: PLACEHOLDER PLACEHOLDER
type: "lookup":
description: PLACEHOLDER "description": |-
PLACEHOLDER
"type":
"description": |-
PLACEHOLDER
github.com/databricks/databricks-sdk-go/service/serving.Ai21LabsConfig: github.com/databricks/databricks-sdk-go/service/serving.Ai21LabsConfig:
ai21labs_api_key: "ai21labs_api_key":
description: PLACEHOLDER "description": |-
ai21labs_api_key_plaintext: PLACEHOLDER
description: PLACEHOLDER "ai21labs_api_key_plaintext":
"description": |-
PLACEHOLDER
github.com/databricks/databricks-sdk-go/service/serving.GoogleCloudVertexAiConfig: github.com/databricks/databricks-sdk-go/service/serving.GoogleCloudVertexAiConfig:
private_key: "private_key":
description: PLACEHOLDER "description": |-
private_key_plaintext: PLACEHOLDER
description: PLACEHOLDER "private_key_plaintext":
project_id: "description": |-
description: PLACEHOLDER PLACEHOLDER
region: "project_id":
description: PLACEHOLDER "description": |-
PLACEHOLDER
"region":
"description": |-
PLACEHOLDER
github.com/databricks/databricks-sdk-go/service/serving.OpenAiConfig: github.com/databricks/databricks-sdk-go/service/serving.OpenAiConfig:
microsoft_entra_client_id: "microsoft_entra_client_id":
description: PLACEHOLDER "description": |-
microsoft_entra_client_secret: PLACEHOLDER
description: PLACEHOLDER "microsoft_entra_client_secret":
microsoft_entra_client_secret_plaintext: "description": |-
description: PLACEHOLDER PLACEHOLDER
microsoft_entra_tenant_id: "microsoft_entra_client_secret_plaintext":
description: PLACEHOLDER "description": |-
openai_api_base: PLACEHOLDER
description: PLACEHOLDER "microsoft_entra_tenant_id":
openai_api_key: "description": |-
description: PLACEHOLDER PLACEHOLDER
openai_api_key_plaintext: "openai_api_base":
description: PLACEHOLDER "description": |-
openai_api_type: PLACEHOLDER
description: PLACEHOLDER "openai_api_key":
openai_api_version: "description": |-
description: PLACEHOLDER PLACEHOLDER
openai_deployment_name: "openai_api_key_plaintext":
description: PLACEHOLDER "description": |-
openai_organization: PLACEHOLDER
description: PLACEHOLDER "openai_api_type":
"description": |-
PLACEHOLDER
"openai_api_version":
"description": |-
PLACEHOLDER
"openai_deployment_name":
"description": |-
PLACEHOLDER
"openai_organization":
"description": |-
PLACEHOLDER
github.com/databricks/databricks-sdk-go/service/serving.PaLmConfig: github.com/databricks/databricks-sdk-go/service/serving.PaLmConfig:
palm_api_key: "palm_api_key":
description: PLACEHOLDER "description": |-
palm_api_key_plaintext: PLACEHOLDER
description: PLACEHOLDER "palm_api_key_plaintext":
"description": |-
PLACEHOLDER

View File

@ -937,7 +937,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"build": { "build": {
"description": "An optional set of non-default build commands that you want to run locally before deployment. For Python wheel builds, the Databricks CLI assumes that it can find a local install of the Python wheel package to run builds, and it runs the command python setup.py bdist_wheel by default during each bundle deployment. To specify multiple build commands, separate each command with double-ampersand (\u0026\u0026) characters.", "description": "An optional set of non-default build commands that you want to run locally before deployment.\n\nFor Python wheel builds, the Databricks CLI assumes that it can find a local install of the Python wheel package to run builds, and it runs the command python setup.py bdist_wheel by default during each bundle deployment.\n\nTo specify multiple build commands, separate each command with double-ampersand (\u0026\u0026) characters.",
"$ref": "#/$defs/string" "$ref": "#/$defs/string"
}, },
"executable": { "executable": {