mirror of https://github.com/databricks/cli.git
Compare commits
3 Commits
3e1a3354f0
...
cf42459b34
Author | SHA1 | Date |
---|---|---|
|
cf42459b34 | |
|
6e8f5f3ace | |
|
229fdb204d |
acceptance/bundle
help
bundle-deploy
bundle-deployment
bundle-destroy
bundle-generate-dashboard
bundle-generate-job
bundle-generate-pipeline
bundle-generate
bundle-init
bundle-open
bundle-run
bundle-schema
bundle-summary
bundle-sync
bundle-validate
bundle
variables
empty
env_overrides
vanilla
var_file_overrides
bundle/config
cmd/bundle
|
@ -19,4 +19,4 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
|
|
@ -18,6 +18,6 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
||||
Use "databricks bundle deployment [command] --help" for more information about a command.
|
||||
|
|
|
@ -16,4 +16,4 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
|
|
@ -22,4 +22,4 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
|
|
@ -19,4 +19,4 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
|
|
@ -19,4 +19,4 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
|
|
@ -21,6 +21,6 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
||||
Use "databricks bundle generate [command] --help" for more information about a command.
|
||||
|
|
|
@ -29,4 +29,4 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
|
|
@ -15,4 +15,4 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
|
|
@ -55,4 +55,4 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
|
|
@ -14,4 +14,4 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
|
|
@ -15,4 +15,4 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
|
|
@ -17,4 +17,4 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
|
|
@ -14,4 +14,4 @@ Global Flags:
|
|||
-p, --profile string ~/.databrickscfg profile
|
||||
-t, --target string bundle target to use (if applicable)
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
|
|
@ -23,7 +23,7 @@ Available Commands:
|
|||
Flags:
|
||||
-h, --help help for bundle
|
||||
--var strings set values for variables defined in bundle config. Example: --var="foo=bar"
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default ".databricks/bundle/<target>/vars.json")
|
||||
--var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle/<target>/variable-overrides.json")
|
||||
|
||||
Global Flags:
|
||||
--debug enable debug logging
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Error: no value assigned to required variable a. Assignment can be done using "--var" or "--var-file", by setting the BUNDLE_VAR_a environment variable, or in .databricks/bundle/<target>/vars.json file
|
||||
Error: no value assigned to required variable a. Assignment can be done using "--var" or "--var-file", by setting the BUNDLE_VAR_a environment variable, or in .databricks/bundle/<target>/variable-overrides.json file
|
||||
|
||||
Name: empty${var.a}
|
||||
Target: default
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"prod-a env-var-b"
|
||||
|
||||
>>> errcode $CLI bundle validate -t env-missing-a-required-variable-assignment
|
||||
Error: no value assigned to required variable b. Assignment can be done using "--var" or "--var-file", by setting the BUNDLE_VAR_b environment variable, or in .databricks/bundle/<target>/vars.json file
|
||||
Error: no value assigned to required variable b. Assignment can be done using "--var" or "--var-file", by setting the BUNDLE_VAR_b environment variable, or in .databricks/bundle/<target>/variable-overrides.json file
|
||||
|
||||
Name: test bundle
|
||||
Target: env-missing-a-required-variable-assignment
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"abc def"
|
||||
|
||||
>>> errcode $CLI bundle validate
|
||||
Error: no value assigned to required variable b. Assignment can be done using "--var" or "--var-file", by setting the BUNDLE_VAR_b environment variable, or in .databricks/bundle/<target>/vars.json file
|
||||
Error: no value assigned to required variable b. Assignment can be done using "--var" or "--var-file", by setting the BUNDLE_VAR_b environment variable, or in .databricks/bundle/<target>/variable-overrides.json file
|
||||
|
||||
Name: ${var.a} ${var.b}
|
||||
Target: default
|
||||
|
|
|
@ -55,7 +55,7 @@ Exit code: 1
|
|||
|
||||
=== file cannot be parsed
|
||||
>>> errcode $CLI bundle validate -o json --var-file=var_files/invalid_json.json
|
||||
Error: failed to parse variables file: error decoding JSON at :0:0: invalid character 'o' in literal false (expecting 'a')
|
||||
Error: failed to parse variables file var_files/invalid_json.json: error decoding JSON at :0:0: invalid character 'o' in literal false (expecting 'a')
|
||||
|
||||
|
||||
Exit code: 1
|
||||
|
@ -128,7 +128,7 @@ Exit code: 1
|
|||
|
||||
=== variable is required but it's not provided in the file
|
||||
>>> errcode $CLI bundle validate -o json --target without-defaults --var-file=var_files/without_required.json
|
||||
Error: no value assigned to required variable cluster. Assignment can be done using "--var" or "--var-file", by setting the BUNDLE_VAR_cluster environment variable, or in .databricks/bundle/<target>/vars.json file
|
||||
Error: no value assigned to required variable cluster. Assignment can be done using "--var" or "--var-file", by setting the BUNDLE_VAR_cluster environment variable, or in .databricks/bundle/<target>/variable-overrides.json file
|
||||
|
||||
|
||||
Exit code: 1
|
||||
|
|
|
@ -64,7 +64,7 @@ func setVariable(ctx context.Context, v dyn.Value, variable *variable.Variable,
|
|||
}
|
||||
|
||||
// We should have had a value to set for the variable at this point.
|
||||
return dyn.InvalidValue, fmt.Errorf(`no value assigned to required variable %s. Assignment can be done using "--var" or "--var-file", by setting the %s environment variable, or in .databricks/bundle/<target>/vars.json file`, name, bundleVarPrefix+name)
|
||||
return dyn.InvalidValue, fmt.Errorf(`no value assigned to required variable %s. Assignment can be done using "--var" or "--var-file", by setting the %s environment variable, or in .databricks/bundle/<target>/variable-overrides.json file`, name, bundleVarPrefix+name)
|
||||
}
|
||||
|
||||
func (m *setVariables) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics {
|
||||
|
|
|
@ -108,7 +108,7 @@ func TestSetVariablesErrorsIfAValueCouldNotBeResolved(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
_, err = setVariable(context.Background(), v, &variable, "foo")
|
||||
assert.ErrorContains(t, err, "no value assigned to required variable foo. Assignment can be done using \"--var\" or \"--var-file\", by setting the BUNDLE_VAR_foo environment variable, or in .databricks/bundle/<target>/vars.json file")
|
||||
assert.ErrorContains(t, err, "no value assigned to required variable foo. Assignment can be done using \"--var\" or \"--var-file\", by setting the BUNDLE_VAR_foo environment variable, or in .databricks/bundle/<target>/variable-overrides.json file")
|
||||
}
|
||||
|
||||
func TestSetVariablesMutator(t *testing.T) {
|
||||
|
|
|
@ -38,7 +38,7 @@ type Variable struct {
|
|||
//
|
||||
// 1. Command line flag `--var="foo=bar"`
|
||||
// 2. Variable value from the file, example: `--var-file="/path/to/file"`.
|
||||
// If path is not specified the default path is used: ".databricks/bundle/<target>/vars.json"
|
||||
// If path is not specified the default path is used: ".databricks/bundle/<target>/variable-overrides.json"
|
||||
// 3. Environment variable. eg: BUNDLE_VAR_foo=bar
|
||||
// 4. Default value as defined in the applicable targets block
|
||||
// 5. Default value defined in variable definition
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
func GetDefaultVariableFilePath(target string) string {
|
||||
return ".databricks/bundle/" + target + "/vars.json"
|
||||
return ".databricks/bundle/" + target + "/variable-overrides.json"
|
||||
}
|
||||
|
||||
func configureVariables(cmd *cobra.Command, b *bundle.Bundle, variables []string) diag.Diagnostics {
|
||||
|
@ -35,7 +35,7 @@ func configureVariablesFromFile(cmd *cobra.Command, b *bundle.Bundle, filePath s
|
|||
|
||||
val, err := jsonloader.LoadJSON(f, filePath)
|
||||
if err != nil {
|
||||
return diag.FromErr(fmt.Errorf("failed to parse variables file: %w", err))
|
||||
return diag.FromErr(fmt.Errorf("failed to parse variables file %s: %w", filePath, err))
|
||||
}
|
||||
|
||||
vars := map[string]any{}
|
||||
|
|
|
@ -10,5 +10,5 @@ import (
|
|||
|
||||
func initVariableFlag(cmd *cobra.Command) {
|
||||
cmd.PersistentFlags().StringSlice("var", []string{}, `set values for variables defined in bundle config. Example: --var="foo=bar"`)
|
||||
cmd.PersistentFlags().String("var-file", "", fmt.Sprintf(`path to a JSON file containing variables. Example: --var-file="/path/to/vars.json" (default "%s")`, utils.GetDefaultVariableFilePath("<target>")))
|
||||
cmd.PersistentFlags().String("var-file", "", fmt.Sprintf(`path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default "%s")`, utils.GetDefaultVariableFilePath("<target>")))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue