From 8f34fc796156ada51cebb124d8ae5c19a8ebdd1e Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Thu, 16 Jan 2025 12:39:59 +0100 Subject: [PATCH] Added output message to warn about slower deployments with apps (#2161) ## Changes When users create one or more Databricks apps in their bundle it can lead to initial bundle deployment being slower because apps need to wait until their compute is fully provisioned and started. This PR adds a message to warn about it. This message will be removed when `no_compute` option becomes available in TF provider and used in DABs (https://github.com/databricks/cli/pull/2144) --- bundle/apps/slow_deploy_message.go | 29 +++++++++++++++++++++++++++++ bundle/phases/deploy.go | 1 + 2 files changed, 30 insertions(+) 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 000000000..6eda39d81 --- /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/phases/deploy.go b/bundle/phases/deploy.go index c6ec04962..1a1ccd47b 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(),