From 229fdb204d46bc841fb47931cbd053b522e9bed0 Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Wed, 22 Jan 2025 13:28:36 +0100 Subject: [PATCH] Use variable-overrides.json name --- acceptance/bundle/help/bundle-deploy/output.txt | 2 +- acceptance/bundle/help/bundle-deployment/output.txt | 2 +- acceptance/bundle/help/bundle-destroy/output.txt | 2 +- acceptance/bundle/help/bundle-generate-dashboard/output.txt | 2 +- acceptance/bundle/help/bundle-generate-job/output.txt | 2 +- acceptance/bundle/help/bundle-generate-pipeline/output.txt | 2 +- acceptance/bundle/help/bundle-generate/output.txt | 2 +- acceptance/bundle/help/bundle-init/output.txt | 2 +- acceptance/bundle/help/bundle-open/output.txt | 2 +- acceptance/bundle/help/bundle-run/output.txt | 2 +- acceptance/bundle/help/bundle-schema/output.txt | 2 +- acceptance/bundle/help/bundle-summary/output.txt | 2 +- acceptance/bundle/help/bundle-sync/output.txt | 2 +- acceptance/bundle/help/bundle-validate/output.txt | 2 +- acceptance/bundle/help/bundle/output.txt | 2 +- acceptance/bundle/variables/empty/output.txt | 2 +- acceptance/bundle/variables/env_overrides/output.txt | 2 +- acceptance/bundle/variables/vanilla/output.txt | 2 +- .../{vars.json => variable-overrides.json} | 0 acceptance/bundle/variables/var_file_overrides/output.txt | 2 +- bundle/config/mutator/set_variables.go | 2 +- bundle/config/variable/variable.go | 2 +- cmd/bundle/utils/utils.go | 2 +- cmd/bundle/variables.go | 2 +- 24 files changed, 23 insertions(+), 23 deletions(-) rename acceptance/bundle/variables/var_file_overrides/.databricks/bundle/with-default-variable-file/{vars.json => variable-overrides.json} (100%) diff --git a/acceptance/bundle/help/bundle-deploy/output.txt b/acceptance/bundle/help/bundle-deploy/output.txt index fc2d62ea5..3720183d9 100644 --- a/acceptance/bundle/help/bundle-deploy/output.txt +++ b/acceptance/bundle/help/bundle-deploy/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") diff --git a/acceptance/bundle/help/bundle-deployment/output.txt b/acceptance/bundle/help/bundle-deployment/output.txt index 70d269013..973363922 100644 --- a/acceptance/bundle/help/bundle-deployment/output.txt +++ b/acceptance/bundle/help/bundle-deployment/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") Use "databricks bundle deployment [command] --help" for more information about a command. diff --git a/acceptance/bundle/help/bundle-destroy/output.txt b/acceptance/bundle/help/bundle-destroy/output.txt index 9c334edba..0c4166ebc 100644 --- a/acceptance/bundle/help/bundle-destroy/output.txt +++ b/acceptance/bundle/help/bundle-destroy/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") diff --git a/acceptance/bundle/help/bundle-generate-dashboard/output.txt b/acceptance/bundle/help/bundle-generate-dashboard/output.txt index 9f3aae313..7ffb6b443 100644 --- a/acceptance/bundle/help/bundle-generate-dashboard/output.txt +++ b/acceptance/bundle/help/bundle-generate-dashboard/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") diff --git a/acceptance/bundle/help/bundle-generate-job/output.txt b/acceptance/bundle/help/bundle-generate-job/output.txt index 66318b335..a0ccb850a 100644 --- a/acceptance/bundle/help/bundle-generate-job/output.txt +++ b/acceptance/bundle/help/bundle-generate-job/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") diff --git a/acceptance/bundle/help/bundle-generate-pipeline/output.txt b/acceptance/bundle/help/bundle-generate-pipeline/output.txt index 648d01348..c04a8c611 100644 --- a/acceptance/bundle/help/bundle-generate-pipeline/output.txt +++ b/acceptance/bundle/help/bundle-generate-pipeline/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") diff --git a/acceptance/bundle/help/bundle-generate/output.txt b/acceptance/bundle/help/bundle-generate/output.txt index fc4003724..44f4a4cd1 100644 --- a/acceptance/bundle/help/bundle-generate/output.txt +++ b/acceptance/bundle/help/bundle-generate/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") Use "databricks bundle generate [command] --help" for more information about a command. diff --git a/acceptance/bundle/help/bundle-init/output.txt b/acceptance/bundle/help/bundle-init/output.txt index ad229755d..e6b7808d8 100644 --- a/acceptance/bundle/help/bundle-init/output.txt +++ b/acceptance/bundle/help/bundle-init/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") diff --git a/acceptance/bundle/help/bundle-open/output.txt b/acceptance/bundle/help/bundle-open/output.txt index a64104b50..861fd2fc3 100644 --- a/acceptance/bundle/help/bundle-open/output.txt +++ b/acceptance/bundle/help/bundle-open/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") diff --git a/acceptance/bundle/help/bundle-run/output.txt b/acceptance/bundle/help/bundle-run/output.txt index 76f5e6e6a..2ea2d282f 100644 --- a/acceptance/bundle/help/bundle-run/output.txt +++ b/acceptance/bundle/help/bundle-run/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") diff --git a/acceptance/bundle/help/bundle-schema/output.txt b/acceptance/bundle/help/bundle-schema/output.txt index d1eeed49e..394c73e59 100644 --- a/acceptance/bundle/help/bundle-schema/output.txt +++ b/acceptance/bundle/help/bundle-schema/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") diff --git a/acceptance/bundle/help/bundle-summary/output.txt b/acceptance/bundle/help/bundle-summary/output.txt index 382e99aac..e49b12927 100644 --- a/acceptance/bundle/help/bundle-summary/output.txt +++ b/acceptance/bundle/help/bundle-summary/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") diff --git a/acceptance/bundle/help/bundle-sync/output.txt b/acceptance/bundle/help/bundle-sync/output.txt index cb977ba2c..b90a32b61 100644 --- a/acceptance/bundle/help/bundle-sync/output.txt +++ b/acceptance/bundle/help/bundle-sync/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") diff --git a/acceptance/bundle/help/bundle-validate/output.txt b/acceptance/bundle/help/bundle-validate/output.txt index f5971e052..7ea6c0f5a 100644 --- a/acceptance/bundle/help/bundle-validate/output.txt +++ b/acceptance/bundle/help/bundle-validate/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") diff --git a/acceptance/bundle/help/bundle/output.txt b/acceptance/bundle/help/bundle/output.txt index 309556762..aa64f8c79 100644 --- a/acceptance/bundle/help/bundle/output.txt +++ b/acceptance/bundle/help/bundle/output.txt @@ -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//vars.json") + --var-file string path to a JSON file containing variables. Example: --var-file="/path/to/variable-overrides.json" (default ".databricks/bundle//variable-overrides.json") Global Flags: --debug enable debug logging diff --git a/acceptance/bundle/variables/empty/output.txt b/acceptance/bundle/variables/empty/output.txt index 4577d725a..cb574ece8 100644 --- a/acceptance/bundle/variables/empty/output.txt +++ b/acceptance/bundle/variables/empty/output.txt @@ -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//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//variable-overrides.json file Name: empty${var.a} Target: default diff --git a/acceptance/bundle/variables/env_overrides/output.txt b/acceptance/bundle/variables/env_overrides/output.txt index ba78a0159..ed16c483e 100644 --- a/acceptance/bundle/variables/env_overrides/output.txt +++ b/acceptance/bundle/variables/env_overrides/output.txt @@ -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//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//variable-overrides.json file Name: test bundle Target: env-missing-a-required-variable-assignment diff --git a/acceptance/bundle/variables/vanilla/output.txt b/acceptance/bundle/variables/vanilla/output.txt index 00f47d5c8..fa390f9dd 100644 --- a/acceptance/bundle/variables/vanilla/output.txt +++ b/acceptance/bundle/variables/vanilla/output.txt @@ -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//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//variable-overrides.json file Name: ${var.a} ${var.b} Target: default diff --git a/acceptance/bundle/variables/var_file_overrides/.databricks/bundle/with-default-variable-file/vars.json b/acceptance/bundle/variables/var_file_overrides/.databricks/bundle/with-default-variable-file/variable-overrides.json similarity index 100% rename from acceptance/bundle/variables/var_file_overrides/.databricks/bundle/with-default-variable-file/vars.json rename to acceptance/bundle/variables/var_file_overrides/.databricks/bundle/with-default-variable-file/variable-overrides.json diff --git a/acceptance/bundle/variables/var_file_overrides/output.txt b/acceptance/bundle/variables/var_file_overrides/output.txt index 3037439fe..988200c81 100644 --- a/acceptance/bundle/variables/var_file_overrides/output.txt +++ b/acceptance/bundle/variables/var_file_overrides/output.txt @@ -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//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//variable-overrides.json file Exit code: 1 diff --git a/bundle/config/mutator/set_variables.go b/bundle/config/mutator/set_variables.go index d94f52547..69fb960f8 100644 --- a/bundle/config/mutator/set_variables.go +++ b/bundle/config/mutator/set_variables.go @@ -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//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//variable-overrides.json file`, name, bundleVarPrefix+name) } func (m *setVariables) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics { diff --git a/bundle/config/variable/variable.go b/bundle/config/variable/variable.go index fd2556ed6..a5c3a0307 100644 --- a/bundle/config/variable/variable.go +++ b/bundle/config/variable/variable.go @@ -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//vars.json" + // If path is not specified the default path is used: ".databricks/bundle//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 diff --git a/cmd/bundle/utils/utils.go b/cmd/bundle/utils/utils.go index 80c7ff790..e7419e792 100644 --- a/cmd/bundle/utils/utils.go +++ b/cmd/bundle/utils/utils.go @@ -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 { diff --git a/cmd/bundle/variables.go b/cmd/bundle/variables.go index f9f7e45bb..79c7af3cf 100644 --- a/cmd/bundle/variables.go +++ b/cmd/bundle/variables.go @@ -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(""))) + 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(""))) }