diff --git a/acceptance/bundle/run/job-ref-job-id/databricks.yml b/acceptance/bundle/run/job-ref-job-id/databricks.yml new file mode 100644 index 00000000000..3b06625845f --- /dev/null +++ b/acceptance/bundle/run/job-ref-job-id/databricks.yml @@ -0,0 +1,13 @@ +bundle: + name: test-bundle + +resources: + jobs: + bar: + name: job bar + foo: + name: job foo + tasks: + - task_key: job_task + run_job_task: + job_id: ${resources.jobs.bar.id} diff --git a/acceptance/bundle/run/job-ref-job-id/out.test.toml b/acceptance/bundle/run/job-ref-job-id/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/run/job-ref-job-id/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/run/job-ref-job-id/output.txt b/acceptance/bundle/run/job-ref-job-id/output.txt new file mode 100644 index 00000000000..b1c11ca57a2 --- /dev/null +++ b/acceptance/bundle/run/job-ref-job-id/output.txt @@ -0,0 +1,20 @@ + +>>> [CLI] bundle deploy +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... +Created jobs.bar +Created jobs.foo +Files: 1 uploaded, 0 deleted +Resources: 2 created, 0 changed, 0 deleted, 0 unchanged + +=== foo's task points at bar's job id +>>> [CLI] jobs get [FOO_ID] +{ + "job_id": [BAR_ID] +} + +=== run resolves the referenced job id into the int job_id field +>>> [CLI] bundle run foo +Run URL: [DATABRICKS_URL]/jobs/[FOO_ID]/runs/[RUN_ID]?o=[WORKSPACE_ID] + +[TIMESTAMP] "job foo" RUNNING +[TIMESTAMP] "job foo" TERMINATED SUCCESS diff --git a/acceptance/bundle/run/job-ref-job-id/script b/acceptance/bundle/run/job-ref-job-id/script new file mode 100644 index 00000000000..49f312b9790 --- /dev/null +++ b/acceptance/bundle/run/job-ref-job-id/script @@ -0,0 +1,8 @@ +trace $CLI bundle deploy +replace_ids.py + +title "foo's task points at bar's job id" +trace $CLI jobs get $(read_id.py foo) | jq '.settings.tasks[0].run_job_task' + +title "run resolves the referenced job id into the int job_id field" +trace $CLI bundle run foo diff --git a/acceptance/bundle/run/job-ref-job-id/test.toml b/acceptance/bundle/run/job-ref-job-id/test.toml new file mode 100644 index 00000000000..3c887dd20bf --- /dev/null +++ b/acceptance/bundle/run/job-ref-job-id/test.toml @@ -0,0 +1,3 @@ +[[Repls]] +Old = '/runs/\d+' +New = '/runs/[RUN_ID]' diff --git a/acceptance/bundle/validate/complex_variable_default_merge/a.yml b/acceptance/bundle/validate/complex_variable_default_merge/a.yml new file mode 100644 index 00000000000..1022dfa415f --- /dev/null +++ b/acceptance/bundle/validate/complex_variable_default_merge/a.yml @@ -0,0 +1,6 @@ +variables: + libs: + type: complex + default: + - one + - two diff --git a/acceptance/bundle/validate/complex_variable_default_merge/b.yml b/acceptance/bundle/validate/complex_variable_default_merge/b.yml new file mode 100644 index 00000000000..b455cc0fe07 --- /dev/null +++ b/acceptance/bundle/validate/complex_variable_default_merge/b.yml @@ -0,0 +1,5 @@ +variables: + libs: + type: complex + default: + - three diff --git a/acceptance/bundle/validate/complex_variable_default_merge/databricks.yml b/acceptance/bundle/validate/complex_variable_default_merge/databricks.yml new file mode 100644 index 00000000000..e125367ca46 --- /dev/null +++ b/acceptance/bundle/validate/complex_variable_default_merge/databricks.yml @@ -0,0 +1,6 @@ +bundle: + name: test-bundle + +include: + - a.yml + - b.yml diff --git a/acceptance/bundle/validate/complex_variable_default_merge/out.test.toml b/acceptance/bundle/validate/complex_variable_default_merge/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/validate/complex_variable_default_merge/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/validate/complex_variable_default_merge/output.txt b/acceptance/bundle/validate/complex_variable_default_merge/output.txt new file mode 100644 index 00000000000..f6b13647c94 --- /dev/null +++ b/acceptance/bundle/validate/complex_variable_default_merge/output.txt @@ -0,0 +1,15 @@ + +>>> [CLI] bundle validate -o json +{ + "default": [ + "one", + "two", + "three" + ], + "type": "complex", + "value": [ + "one", + "two", + "three" + ] +} diff --git a/acceptance/bundle/validate/complex_variable_default_merge/script b/acceptance/bundle/validate/complex_variable_default_merge/script new file mode 100644 index 00000000000..f7e09655323 --- /dev/null +++ b/acceptance/bundle/validate/complex_variable_default_merge/script @@ -0,0 +1 @@ +trace $CLI bundle validate -o json | jq .variables.libs diff --git a/acceptance/bundle/validate/compute_id_location/databricks.yml b/acceptance/bundle/validate/compute_id_location/databricks.yml new file mode 100644 index 00000000000..b6a32c6c39c --- /dev/null +++ b/acceptance/bundle/validate/compute_id_location/databricks.yml @@ -0,0 +1,9 @@ +bundle: + name: test-bundle + compute_id: root-cluster + +targets: + dev: + compute_id: dev-cluster + other: + default: true diff --git a/acceptance/bundle/validate/compute_id_location/out.test.toml b/acceptance/bundle/validate/compute_id_location/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/validate/compute_id_location/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/validate/compute_id_location/output.txt b/acceptance/bundle/validate/compute_id_location/output.txt new file mode 100644 index 00000000000..d8d3966b1d7 --- /dev/null +++ b/acceptance/bundle/validate/compute_id_location/output.txt @@ -0,0 +1,36 @@ + +=== default target without compute_id +>>> [CLI] bundle validate +Warning: compute_id is deprecated, please use cluster_id instead + at bundle.compute_id + in databricks.yml:3:15 + +Warning: compute_id is deprecated, please use cluster_id instead + at compute_id + in databricks.yml:7:17 + +Name: test-bundle +Target: other +Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/other + +Found 2 warnings + +=== target with compute_id +>>> [CLI] bundle validate -t dev +Warning: compute_id is deprecated, please use cluster_id instead + at bundle.compute_id + in databricks.yml:3:15 + +Warning: compute_id is deprecated, please use cluster_id instead + at compute_id + in databricks.yml:7:17 + +Name: test-bundle +Target: dev +Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/dev + +Found 2 warnings diff --git a/acceptance/bundle/validate/compute_id_location/script b/acceptance/bundle/validate/compute_id_location/script new file mode 100644 index 00000000000..44c1cf2f4ba --- /dev/null +++ b/acceptance/bundle/validate/compute_id_location/script @@ -0,0 +1,5 @@ +title "default target without compute_id" +trace $CLI bundle validate + +title "target with compute_id" +trace $CLI bundle validate -t dev diff --git a/acceptance/bundle/validate/compute_id_location/test.toml b/acceptance/bundle/validate/compute_id_location/test.toml new file mode 100644 index 00000000000..d2d1c82e6d3 --- /dev/null +++ b/acceptance/bundle/validate/compute_id_location/test.toml @@ -0,0 +1 @@ +Badness = "Target-level compute_id is reported without the target in the path (at compute_id instead of at targets.dev.compute_id), and is reported even when that target is not selected." diff --git a/acceptance/bundle/validate/dashboard_key_special_chars/databricks.yml b/acceptance/bundle/validate/dashboard_key_special_chars/databricks.yml new file mode 100644 index 00000000000..b052b780d11 --- /dev/null +++ b/acceptance/bundle/validate/dashboard_key_special_chars/databricks.yml @@ -0,0 +1,14 @@ +bundle: + name: test-bundle + +targets: + bracket: + resources: + dashboards: + "reports[": + serialized_dashboard: "{}" + comma: + resources: + dashboards: + "a,b": + serialized_dashboard: "{}" diff --git a/acceptance/bundle/validate/dashboard_key_special_chars/out.test.toml b/acceptance/bundle/validate/dashboard_key_special_chars/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/validate/dashboard_key_special_chars/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/validate/dashboard_key_special_chars/output.txt b/acceptance/bundle/validate/dashboard_key_special_chars/output.txt new file mode 100644 index 00000000000..7c66843a334 --- /dev/null +++ b/acceptance/bundle/validate/dashboard_key_special_chars/output.txt @@ -0,0 +1,38 @@ + +>>> [CLI] bundle validate -t bracket +Error: dashboard display_name is required + at resources.dashboards['reports['] + in databricks.yml:9:11 + +Error: dashboard warehouse_id is required + at resources.dashboards['reports['] + in databricks.yml:9:11 + +Name: test-bundle +Target: bracket +Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/bracket + +Found 2 errors + +Exit code: 1 + +>>> [CLI] bundle validate -t comma +Error: dashboard display_name is required + at resources.dashboards['a,b'] + in databricks.yml:14:11 + +Error: dashboard warehouse_id is required + at resources.dashboards['a,b'] + in databricks.yml:14:11 + +Name: test-bundle +Target: comma +Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/comma + +Found 2 errors + +Exit code: 1 diff --git a/acceptance/bundle/validate/dashboard_key_special_chars/script b/acceptance/bundle/validate/dashboard_key_special_chars/script new file mode 100644 index 00000000000..85c1fa07a03 --- /dev/null +++ b/acceptance/bundle/validate/dashboard_key_special_chars/script @@ -0,0 +1,9 @@ +# Dashboards missing display_name / warehouse_id must be reported even when the +# resource key contains characters that are path syntax ("[", ","). The required-field +# check looks the dashboard up by path, so a key that does not survive being turned +# into a path string would silently drop these errors. +# +# Each key is in its own target: with both in one config the errors are reported in +# a nondeterministic order. +errcode trace $CLI bundle validate -t bracket +errcode trace $CLI bundle validate -t comma diff --git a/acceptance/bundle/validate/override_effective_location/databricks.yml b/acceptance/bundle/validate/override_effective_location/databricks.yml new file mode 100644 index 00000000000..65bb7a5bd13 --- /dev/null +++ b/acceptance/bundle/validate/override_effective_location/databricks.yml @@ -0,0 +1,21 @@ +bundle: + name: test-bundle + engine: direct + +presets: + trigger_pause_status: PAUSED + name_prefix: "${workspace.current_user.short_name}_" + +targets: + bad_engine: + bundle: + engine: invalid_value + dev_trigger: + mode: development + default: true + presets: + trigger_pause_status: UNPAUSED + dev_prefix: + mode: development + presets: + name_prefix: nouser_ diff --git a/acceptance/bundle/validate/override_effective_location/out.test.toml b/acceptance/bundle/validate/override_effective_location/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/validate/override_effective_location/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/validate/override_effective_location/output.txt b/acceptance/bundle/validate/override_effective_location/output.txt new file mode 100644 index 00000000000..e3fa5193367 --- /dev/null +++ b/acceptance/bundle/validate/override_effective_location/output.txt @@ -0,0 +1,42 @@ + +=== engine overridden in target +>>> [CLI] bundle validate -t bad_engine +Error: invalid value "invalid_value" for bundle.engine (expected "direct") + in databricks.yml:12:15 + +Name: test-bundle +Target: bad_engine + +Found 1 error + +Exit code: 1 + +=== trigger_pause_status overridden in development target +>>> [CLI] bundle validate -t dev_trigger +Error: target with 'mode: development' cannot set trigger pause status to UNPAUSED by default + in databricks.yml:17:29 + +Name: test-bundle +Target: dev_trigger +Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/dev_trigger + +Found 1 error + +Exit code: 1 + +=== name_prefix overridden in development target +>>> [CLI] bundle validate -t dev_prefix +Error: prefix should contain the current username or ${workspace.current_user.short_name} to ensure uniqueness when using 'mode: development' + in databricks.yml:21:20 + +Name: test-bundle +Target: dev_prefix +Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/dev_prefix + +Found 1 error + +Exit code: 1 diff --git a/acceptance/bundle/validate/override_effective_location/script b/acceptance/bundle/validate/override_effective_location/script new file mode 100644 index 00000000000..b3ebee43c0f --- /dev/null +++ b/acceptance/bundle/validate/override_effective_location/script @@ -0,0 +1,8 @@ +title "engine overridden in target" +errcode trace $CLI bundle validate -t bad_engine + +title "trigger_pause_status overridden in development target" +errcode trace $CLI bundle validate -t dev_trigger + +title "name_prefix overridden in development target" +errcode trace $CLI bundle validate -t dev_prefix diff --git a/acceptance/bundle/validate/pipeline_development_reference/databricks.yml b/acceptance/bundle/validate/pipeline_development_reference/databricks.yml new file mode 100644 index 00000000000..59bf09ca3d5 --- /dev/null +++ b/acceptance/bundle/validate/pipeline_development_reference/databricks.yml @@ -0,0 +1,10 @@ +bundle: + name: test-bundle + +resources: + pipelines: + other: + name: other + main: + name: main + development: ${resources.pipelines.other.development} diff --git a/acceptance/bundle/validate/pipeline_development_reference/out.test.toml b/acceptance/bundle/validate/pipeline_development_reference/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/validate/pipeline_development_reference/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/validate/pipeline_development_reference/output.txt b/acceptance/bundle/validate/pipeline_development_reference/output.txt new file mode 100644 index 00000000000..f808fa83528 --- /dev/null +++ b/acceptance/bundle/validate/pipeline_development_reference/output.txt @@ -0,0 +1,14 @@ + +>>> [CLI] bundle validate +Warning: The "development" property of pipelines is deprecated. Use "mode: development" in your databricks.yml instead. See https://docs.databricks.com/dev-tools/bundles/deployment-modes. + at resources.pipelines.main.development + in databricks.yml:10:20 + +Name: test-bundle +Target: default +Workspace: + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default + +Found 1 warning +"${resources.pipelines.other.development}" diff --git a/acceptance/bundle/validate/pipeline_development_reference/script b/acceptance/bundle/validate/pipeline_development_reference/script new file mode 100644 index 00000000000..c72489ac254 --- /dev/null +++ b/acceptance/bundle/validate/pipeline_development_reference/script @@ -0,0 +1,3 @@ +trace $CLI bundle validate + +trace $CLI bundle validate -o json 2>/dev/null | jq .resources.pipelines.main.development diff --git a/acceptance/bundle/validate/target_variable_full_def_merge_key/databricks.yml b/acceptance/bundle/validate/target_variable_full_def_merge_key/databricks.yml new file mode 100644 index 00000000000..f7bac987ac3 --- /dev/null +++ b/acceptance/bundle/validate/target_variable_full_def_merge_key/databricks.yml @@ -0,0 +1,13 @@ +bundle: + name: test-bundle + +variables: + x: &x + default: old + +targets: + dev: + variables: + x: + <<: *x + default: new diff --git a/acceptance/bundle/validate/target_variable_full_def_merge_key/out.test.toml b/acceptance/bundle/validate/target_variable_full_def_merge_key/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/validate/target_variable_full_def_merge_key/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/validate/target_variable_full_def_merge_key/output.txt b/acceptance/bundle/validate/target_variable_full_def_merge_key/output.txt new file mode 100644 index 00000000000..d9ce0976398 --- /dev/null +++ b/acceptance/bundle/validate/target_variable_full_def_merge_key/output.txt @@ -0,0 +1,6 @@ + +>>> [CLI] bundle validate -t dev -o json +{ + "default": "new", + "value": "new" +} diff --git a/acceptance/bundle/validate/target_variable_full_def_merge_key/script b/acceptance/bundle/validate/target_variable_full_def_merge_key/script new file mode 100644 index 00000000000..9f33dba3103 --- /dev/null +++ b/acceptance/bundle/validate/target_variable_full_def_merge_key/script @@ -0,0 +1 @@ +trace $CLI bundle validate -t dev -o json | jq .variables.x diff --git a/acceptance/bundle/validate/target_variable_merge_key_precedence/databricks.yml b/acceptance/bundle/validate/target_variable_merge_key_precedence/databricks.yml new file mode 100644 index 00000000000..d4e45925b2d --- /dev/null +++ b/acceptance/bundle/validate/target_variable_merge_key_precedence/databricks.yml @@ -0,0 +1,16 @@ +bundle: + name: test-bundle + +variables: + x: + +definitions: + a: &a + x: from-a + b: &b + x: from-b + +targets: + dev: + variables: + <<: [*a, *b] diff --git a/acceptance/bundle/validate/target_variable_merge_key_precedence/out.test.toml b/acceptance/bundle/validate/target_variable_merge_key_precedence/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/validate/target_variable_merge_key_precedence/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/validate/target_variable_merge_key_precedence/output.txt b/acceptance/bundle/validate/target_variable_merge_key_precedence/output.txt new file mode 100644 index 00000000000..e8bc246c483 --- /dev/null +++ b/acceptance/bundle/validate/target_variable_merge_key_precedence/output.txt @@ -0,0 +1,8 @@ + +>>> [CLI] bundle validate -t dev -o json +{ + "x": { + "default": "from-b", + "value": "from-b" + } +} diff --git a/acceptance/bundle/validate/target_variable_merge_key_precedence/script b/acceptance/bundle/validate/target_variable_merge_key_precedence/script new file mode 100644 index 00000000000..ab024d811b0 --- /dev/null +++ b/acceptance/bundle/validate/target_variable_merge_key_precedence/script @@ -0,0 +1 @@ +trace $CLI bundle validate -t dev -o json | jq .variables diff --git a/acceptance/bundle/validate/target_variable_merge_key_precedence/test.toml b/acceptance/bundle/validate/target_variable_merge_key_precedence/test.toml new file mode 100644 index 00000000000..5fba7c799c1 --- /dev/null +++ b/acceptance/bundle/validate/target_variable_merge_key_precedence/test.toml @@ -0,0 +1 @@ +Badness = "With <<: [*a, *b] the later anchor wins; the YAML merge key spec gives precedence to the earlier one." diff --git a/acceptance/bundle/validate/target_variable_shorthand_alias/databricks.yml b/acceptance/bundle/validate/target_variable_shorthand_alias/databricks.yml new file mode 100644 index 00000000000..dab70888e89 --- /dev/null +++ b/acceptance/bundle/validate/target_variable_shorthand_alias/databricks.yml @@ -0,0 +1,22 @@ +bundle: + name: test-bundle + +variables: + env: + region: + size: + other: + +definitions: + dev_env: &dev "dev-value" + common: &common + region: us-east-1 + size: small + +targets: + dev: + variables: + env: *dev + <<: *common + size: large + other: plain diff --git a/acceptance/bundle/validate/target_variable_shorthand_alias/out.test.toml b/acceptance/bundle/validate/target_variable_shorthand_alias/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/validate/target_variable_shorthand_alias/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/validate/target_variable_shorthand_alias/output.txt b/acceptance/bundle/validate/target_variable_shorthand_alias/output.txt new file mode 100644 index 00000000000..73f378fee1c --- /dev/null +++ b/acceptance/bundle/validate/target_variable_shorthand_alias/output.txt @@ -0,0 +1,20 @@ + +>>> [CLI] bundle validate -t dev -o json +{ + "env": { + "default": "dev-value", + "value": "dev-value" + }, + "other": { + "default": "plain", + "value": "plain" + }, + "region": { + "default": "us-east-1", + "value": "us-east-1" + }, + "size": { + "default": "large", + "value": "large" + } +} diff --git a/acceptance/bundle/validate/target_variable_shorthand_alias/script b/acceptance/bundle/validate/target_variable_shorthand_alias/script new file mode 100644 index 00000000000..ab024d811b0 --- /dev/null +++ b/acceptance/bundle/validate/target_variable_shorthand_alias/script @@ -0,0 +1 @@ +trace $CLI bundle validate -t dev -o json | jq .variables diff --git a/acceptance/bundle/validate/task_source_empty_string/databricks.yml b/acceptance/bundle/validate/task_source_empty_string/databricks.yml new file mode 100644 index 00000000000..03e95eb7307 --- /dev/null +++ b/acceptance/bundle/validate/task_source_empty_string/databricks.yml @@ -0,0 +1,16 @@ +bundle: + name: test-bundle + +resources: + jobs: + my_job: + name: my job + git_source: + git_url: https://github.com/databricks/cli + git_provider: gitHub + git_branch: main + tasks: + - task_key: main + notebook_task: + notebook_path: ./notebook + source: "" diff --git a/acceptance/bundle/validate/task_source_empty_string/out.test.toml b/acceptance/bundle/validate/task_source_empty_string/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/validate/task_source_empty_string/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/validate/task_source_empty_string/output.txt b/acceptance/bundle/validate/task_source_empty_string/output.txt new file mode 100644 index 00000000000..997343d5302 --- /dev/null +++ b/acceptance/bundle/validate/task_source_empty_string/output.txt @@ -0,0 +1,10 @@ + +>>> [CLI] bundle validate -o json +[ + { + "notebook_task": { + "notebook_path": "./notebook" + }, + "task_key": "main" + } +] diff --git a/acceptance/bundle/validate/task_source_empty_string/script b/acceptance/bundle/validate/task_source_empty_string/script new file mode 100644 index 00000000000..b6b3d99b901 --- /dev/null +++ b/acceptance/bundle/validate/task_source_empty_string/script @@ -0,0 +1 @@ +trace $CLI bundle validate -o json | jq .resources.jobs.my_job.tasks diff --git a/acceptance/bundle/validate/variable_overrides_file_complex_path/databricks.yml b/acceptance/bundle/validate/variable_overrides_file_complex_path/databricks.yml new file mode 100644 index 00000000000..abeb913a709 --- /dev/null +++ b/acceptance/bundle/validate/variable_overrides_file_complex_path/databricks.yml @@ -0,0 +1,17 @@ +bundle: + name: test-bundle + +variables: + task: + type: complex + +resources: + jobs: + my_job: + name: my job + tasks: + - ${var.task} + +targets: + default: + default: true diff --git a/acceptance/bundle/validate/variable_overrides_file_complex_path/out.test.toml b/acceptance/bundle/validate/variable_overrides_file_complex_path/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/validate/variable_overrides_file_complex_path/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/validate/variable_overrides_file_complex_path/output.txt b/acceptance/bundle/validate/variable_overrides_file_complex_path/output.txt new file mode 100644 index 00000000000..87fb1b3b20b --- /dev/null +++ b/acceptance/bundle/validate/variable_overrides_file_complex_path/output.txt @@ -0,0 +1,21 @@ + +>>> [CLI] bundle validate -o json +Error: path src/main.py is defined relative to the [TEST_TMP_DIR] directory ([TEST_TMP_DIR]/.databricks/bundle/default/variable-overrides.json:6:37). Please update the path to be relative to the file where it is defined or use earlier version of CLI (0.261.0 or earlier). + in .databricks/bundle/default/variable-overrides.json:6:37 + + +Exit code: 1 +[ + { + "existing_cluster_id": "0123-456789-abcdefgh", + "libraries": [ + { + "whl": ".databricks/bundle/default/src/lib.whl" + } + ], + "spark_python_task": { + "python_file": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/src/main.py" + }, + "task_key": "main" + } +] diff --git a/acceptance/bundle/validate/variable_overrides_file_complex_path/script b/acceptance/bundle/validate/variable_overrides_file_complex_path/script new file mode 100644 index 00000000000..ade57be3b05 --- /dev/null +++ b/acceptance/bundle/validate/variable_overrides_file_complex_path/script @@ -0,0 +1,3 @@ +mkdir -p .databricks/bundle/default +mv variable-overrides.json .databricks/bundle/default/ +errcode trace $CLI bundle validate -o json | jq '.resources.jobs.my_job.tasks' diff --git a/acceptance/bundle/validate/variable_overrides_file_complex_path/src/lib.whl b/acceptance/bundle/validate/variable_overrides_file_complex_path/src/lib.whl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/acceptance/bundle/validate/variable_overrides_file_complex_path/src/main.py b/acceptance/bundle/validate/variable_overrides_file_complex_path/src/main.py new file mode 100644 index 00000000000..b80e3222ab2 --- /dev/null +++ b/acceptance/bundle/validate/variable_overrides_file_complex_path/src/main.py @@ -0,0 +1 @@ +print("hi") diff --git a/acceptance/bundle/validate/variable_overrides_file_complex_path/test.toml b/acceptance/bundle/validate/variable_overrides_file_complex_path/test.toml new file mode 100644 index 00000000000..ca5df96f13e --- /dev/null +++ b/acceptance/bundle/validate/variable_overrides_file_complex_path/test.toml @@ -0,0 +1,5 @@ +Badness = "Relative paths in variable-overrides.json resolve inconsistently: task files are resolved against the bundle root (with an error), libraries relative to the overrides file." + +[[Repls]] +Old = '\\' +New = '/' diff --git a/acceptance/bundle/validate/variable_overrides_file_complex_path/variable-overrides.json b/acceptance/bundle/validate/variable_overrides_file_complex_path/variable-overrides.json new file mode 100644 index 00000000000..3a44bf858e0 --- /dev/null +++ b/acceptance/bundle/validate/variable_overrides_file_complex_path/variable-overrides.json @@ -0,0 +1,14 @@ +{ + "task": { + "task_key": "main", + "existing_cluster_id": "0123-456789-abcdefgh", + "spark_python_task": { + "python_file": "./src/main.py" + }, + "libraries": [ + { + "whl": "./src/lib.whl" + } + ] + } +} diff --git a/acceptance/bundle/validate/yaml_anchor_cycle_nested/databricks.yml b/acceptance/bundle/validate/yaml_anchor_cycle_nested/databricks.yml new file mode 100644 index 00000000000..41bfacdc5b5 --- /dev/null +++ b/acceptance/bundle/validate/yaml_anchor_cycle_nested/databricks.yml @@ -0,0 +1,8 @@ +bundle: + name: test-bundle + +variables: + v: + default: &x + a: + - *x diff --git a/acceptance/bundle/validate/yaml_anchor_cycle_nested/out.test.toml b/acceptance/bundle/validate/yaml_anchor_cycle_nested/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/validate/yaml_anchor_cycle_nested/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/validate/yaml_anchor_cycle_nested/output.txt b/acceptance/bundle/validate/yaml_anchor_cycle_nested/output.txt new file mode 100644 index 00000000000..8226094673d --- /dev/null +++ b/acceptance/bundle/validate/yaml_anchor_cycle_nested/output.txt @@ -0,0 +1,8 @@ + +>>> [CLI] bundle validate +Error: failed to load [TEST_TMP_DIR]/databricks.yml: yaml ([TEST_TMP_DIR]/databricks.yml:8:11): cyclic reference to anchor "x" + + +Found 1 error + +Exit code: 1 diff --git a/acceptance/bundle/validate/yaml_anchor_cycle_nested/script b/acceptance/bundle/validate/yaml_anchor_cycle_nested/script new file mode 100644 index 00000000000..f52b452ee67 --- /dev/null +++ b/acceptance/bundle/validate/yaml_anchor_cycle_nested/script @@ -0,0 +1 @@ +errcode trace $CLI bundle validate diff --git a/acceptance/bundle/validate/yaml_anchor_cycle_nested/test.toml b/acceptance/bundle/validate/yaml_anchor_cycle_nested/test.toml new file mode 100644 index 00000000000..a298217f218 --- /dev/null +++ b/acceptance/bundle/validate/yaml_anchor_cycle_nested/test.toml @@ -0,0 +1,3 @@ +[[Repls]] +Old = '\\' +New = '/'