diff --git a/acceptance/bundle/summary/show-full-config/databricks.yml b/acceptance/bundle/summary/show-full-config/databricks.yml index 2158f90476..08ac0519c7 100644 --- a/acceptance/bundle/summary/show-full-config/databricks.yml +++ b/acceptance/bundle/summary/show-full-config/databricks.yml @@ -3,6 +3,7 @@ bundle: include: - targets/*.yml + - resources/*.yml variables: mode: diff --git a/acceptance/bundle/summary/show-full-config/output.txt b/acceptance/bundle/summary/show-full-config/output.txt index c75fca854b..81654d8230 100644 --- a/acceptance/bundle/summary/show-full-config/output.txt +++ b/acceptance/bundle/summary/show-full-config/output.txt @@ -1,6 +1,88 @@ ->>> [CLI] bundle summary --show-full-config +>>> [CLI] bundle summary --show-full-config --include-locations { + "__locations": { + "files": [ + "databricks.yml", + "resources/my_dashboard.dashboard.yml", + "targets/default.yml", + "targets/not_default.yml", + "targets/variable_default.yml", + "targets/variable_mode.yml" + ], + "locations": { + "bundle": [ + [ + 0, + 2, + 3 + ] + ], + "include": [ + [ + 0, + 5, + 3 + ] + ], + "resources": [ + [ + 1, + 2, + 3 + ] + ], + "resources.dashboards": [ + [ + 1, + 3, + 5 + ] + ], + "resources.dashboards.my_dashboard": [ + [ + 1, + 4, + 7 + ] + ], + "targets": [ + [ + 0, + 15, + 3 + ], + [ + 2, + 2, + 3 + ], + [ + 3, + 2, + 3 + ], + [ + 4, + 2, + 3 + ], + [ + 5, + 2, + 3 + ] + ], + "variables": [ + [ + 0, + 9, + 3 + ] + ] + }, + "version": 1 + }, "bundle": { "name": "test-bundle" }, @@ -8,8 +90,18 @@ "targets/default.yml", "targets/not_default.yml", "targets/variable_default.yml", - "targets/variable_mode.yml" + "targets/variable_mode.yml", + "resources/my_dashboard.dashboard.yml" ], + "resources": { + "dashboards": { + "my_dashboard": { + "display_name": "My Dashboard", + "file_path": "../src/my_dashboard.lvdash.json", + "warehouse_id": "[NUMID]abcdef" + } + } + }, "targets": { "also_default": { "default": true, diff --git a/acceptance/bundle/summary/show-full-config/resources/my_dashboard.dashboard.yml b/acceptance/bundle/summary/show-full-config/resources/my_dashboard.dashboard.yml new file mode 100644 index 0000000000..07ff8d8f75 --- /dev/null +++ b/acceptance/bundle/summary/show-full-config/resources/my_dashboard.dashboard.yml @@ -0,0 +1,6 @@ +resources: + dashboards: + my_dashboard: + display_name: My Dashboard + file_path: ../src/my_dashboard.lvdash.json + warehouse_id: 1234567890abcdef diff --git a/acceptance/bundle/summary/show-full-config/script b/acceptance/bundle/summary/show-full-config/script index 1c76f0c443..eccfb0544c 100644 --- a/acceptance/bundle/summary/show-full-config/script +++ b/acceptance/bundle/summary/show-full-config/script @@ -1 +1 @@ -trace $CLI bundle summary --show-full-config +trace $CLI bundle summary --show-full-config --include-locations diff --git a/acceptance/bundle/summary/show-full-config/src/my_dashboard.lvdash.json b/acceptance/bundle/summary/show-full-config/src/my_dashboard.lvdash.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/acceptance/bundle/summary/show-full-config/src/my_dashboard.lvdash.json @@ -0,0 +1 @@ +{} diff --git a/cmd/bundle/summary.go b/cmd/bundle/summary.go index 63b6e0529c..9f2aa3e54b 100644 --- a/cmd/bundle/summary.go +++ b/cmd/bundle/summary.go @@ -39,7 +39,7 @@ Useful after deployment to see what was created and where to find it.`, cmd.SetContext(ctx) logdiag.SetSeverity(ctx, diag.Warning) - err = showFullConfig(ctx, cmd) + err = showFullConfig(ctx, cmd, includeLocations) if err != nil { return err } @@ -68,7 +68,7 @@ Useful after deployment to see what was created and where to find it.`, return cmd } -func showFullConfig(ctx context.Context, cmd *cobra.Command) error { +func showFullConfig(ctx context.Context, cmd *cobra.Command, includeLocations bool) error { // call `MustLoad` directly instead of `MustConfigureBundle` because the latter does // validation that we're not interested in here b := bundle.MustLoad(ctx) @@ -81,6 +81,14 @@ func showFullConfig(ctx context.Context, cmd *cobra.Command) error { return nil } + if includeLocations { + // Include location information in the output + bundle.ApplyContext(ctx, b, mutator.PopulateLocations()) + if logdiag.HasError(ctx) { + return nil + } + } + err := renderJsonOutput(cmd, b) if err != nil { return err