From 31d44e8ef8163e2f14274dcb6e9a9ecf2bc27621 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Thu, 16 Jan 2025 10:49:00 +0000 Subject: [PATCH 1/2] Added output message to warn about slower deployments with apps --- bundle/apps/validate.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bundle/apps/validate.go b/bundle/apps/validate.go index fc50aeafc7..42f4a25f58 100644 --- a/bundle/apps/validate.go +++ b/bundle/apps/validate.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/databricks/cli/bundle" + "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/diag" ) @@ -17,6 +18,10 @@ func (v *validate) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics possibleConfigFiles := []string{"app.yml", "app.yaml"} usedSourceCodePaths := make(map[string]string) + if len(b.Config.Resources.Apps) > 0 { + cmdio.LogString(ctx, "Databricks apps in your bundle can slow initial deployment as they wait for compute provisioning.") + } + for key, app := range b.Config.Resources.Apps { if _, ok := usedSourceCodePaths[app.SourceCodePath]; ok { diags = append(diags, diag.Diagnostic{ From 6a06ed0421b8a908962fab9e3e5952aa359aaa12 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Thu, 16 Jan 2025 11:23:07 +0000 Subject: [PATCH 2/2] show on deploy only --- bundle/apps/slow_deploy_message.go | 29 +++++++++++++++++++++++++++++ bundle/apps/validate.go | 5 ----- bundle/phases/deploy.go | 1 + 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 bundle/apps/slow_deploy_message.go diff --git a/bundle/apps/slow_deploy_message.go b/bundle/apps/slow_deploy_message.go new file mode 100644 index 0000000000..6eda39d818 --- /dev/null +++ b/bundle/apps/slow_deploy_message.go @@ -0,0 +1,29 @@ +package apps + +import ( + "context" + + "github.com/databricks/cli/bundle" + "github.com/databricks/cli/libs/cmdio" + "github.com/databricks/cli/libs/diag" +) + +type slowDeployMessage struct{} + +// TODO: needs to be removed when when no_compute option becomes available in TF provider and used in DABs +// See https://github.com/databricks/cli/pull/2144 +func (v *slowDeployMessage) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics { + if len(b.Config.Resources.Apps) > 0 { + cmdio.LogString(ctx, "Databricks apps in your bundle can slow initial deployment as they wait for compute provisioning.") + } + + return nil +} + +func (v *slowDeployMessage) Name() string { + return "apps.SlowDeployMessage" +} + +func SlowDeployMessage() bundle.Mutator { + return &slowDeployMessage{} +} diff --git a/bundle/apps/validate.go b/bundle/apps/validate.go index 42f4a25f58..fc50aeafc7 100644 --- a/bundle/apps/validate.go +++ b/bundle/apps/validate.go @@ -7,7 +7,6 @@ import ( "strings" "github.com/databricks/cli/bundle" - "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/diag" ) @@ -18,10 +17,6 @@ func (v *validate) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics possibleConfigFiles := []string{"app.yml", "app.yaml"} usedSourceCodePaths := make(map[string]string) - if len(b.Config.Resources.Apps) > 0 { - cmdio.LogString(ctx, "Databricks apps in your bundle can slow initial deployment as they wait for compute provisioning.") - } - for key, app := range b.Config.Resources.Apps { if _, ok := usedSourceCodePaths[app.SourceCodePath]; ok { diags = append(diags, diag.Diagnostic{ diff --git a/bundle/phases/deploy.go b/bundle/phases/deploy.go index c6ec04962e..1a1ccd47b1 100644 --- a/bundle/phases/deploy.go +++ b/bundle/phases/deploy.go @@ -136,6 +136,7 @@ func Deploy(outputHandler sync.OutputHandler) bundle.Mutator { bundle.Seq( terraform.StatePush(), terraform.Load(), + apps.SlowDeployMessage(), apps.InterpolateVariables(), apps.UploadConfig(), metadata.Compute(),