mirror of https://github.com/databricks/cli.git
Add warning when include is used in config files other than databricks.yml (#2389)
## Changes Defining an include section in config files other than the main `databricks.yml` file fails silently. With this PR users will get a warning when they try this. ## Tests Acceptance test.
This commit is contained in:
parent
bf2aded8e9
commit
eb57dbd844
|
@ -0,0 +1,4 @@
|
|||
include:
|
||||
- b.yml
|
||||
- c.yml
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
bundle:
|
||||
name: include_outside_root
|
||||
|
||||
include:
|
||||
- a.yml
|
|
@ -0,0 +1,16 @@
|
|||
Warning: Include section is defined outside root file
|
||||
at include
|
||||
in a.yml:2:3
|
||||
|
||||
The include section is defined in a file that is not the root file.
|
||||
These values will be ignored because only the includes defined in
|
||||
the bundle root file (that is databricks.yml or databricks.yaml)
|
||||
are loaded.
|
||||
|
||||
Name: include_outside_root
|
||||
Target: default
|
||||
Workspace:
|
||||
User: [USERNAME]
|
||||
Path: /Workspace/Users/[USERNAME]/.bundle/include_outside_root/default
|
||||
|
||||
Found 1 warning
|
|
@ -0,0 +1 @@
|
|||
$CLI bundle validate
|
|
@ -161,6 +161,19 @@ func (m *processInclude) Apply(_ context.Context, b *bundle.Bundle) diag.Diagnos
|
|||
return diags
|
||||
}
|
||||
|
||||
if len(this.Include) > 0 {
|
||||
diags = diags.Append(diag.Diagnostic{
|
||||
Severity: diag.Warning,
|
||||
Summary: "Include section is defined outside root file",
|
||||
Detail: `The include section is defined in a file that is not the root file.
|
||||
These values will be ignored because only the includes defined in
|
||||
the bundle root file (that is databricks.yml or databricks.yaml)
|
||||
are loaded.`,
|
||||
Locations: this.GetLocations("include"),
|
||||
Paths: []dyn.Path{dyn.MustPathFromString("include")},
|
||||
})
|
||||
}
|
||||
|
||||
err := b.Config.Merge(this)
|
||||
if err != nil {
|
||||
diags = diags.Extend(diag.FromErr(err))
|
||||
|
|
Loading…
Reference in New Issue