From b624ce999a9ae3ddaad2b0bc85218810c14f4371 Mon Sep 17 00:00:00 2001 From: Lennart Kats Date: Wed, 4 Dec 2024 21:06:22 +0100 Subject: [PATCH] Updating messages --- bundle/config/mutator/override_compute.go | 7 +++++-- bundle/config/mutator/override_compute_test.go | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bundle/config/mutator/override_compute.go b/bundle/config/mutator/override_compute.go index e68538861..2e14b5824 100644 --- a/bundle/config/mutator/override_compute.go +++ b/bundle/config/mutator/override_compute.go @@ -44,14 +44,17 @@ func (m *overrideCompute) Apply(ctx context.Context, b *bundle.Bundle) diag.Diag if b.Config.Bundle.Mode == config.Production { if b.Config.Bundle.ClusterId != "" { // Overriding compute via a command-line flag for production works, but is not recommended. - diags = diags.Extend(diag.Warningf("Overriding compute for a target that uses 'mode: production' is not recommended")) + diags = diags.Extend(diag.Diagnostics{{ + Summary: "Setting a cluster override for a target that uses 'mode: production' is not recommended", + Detail: "It is recommended to always use the same compute for production target for consistency.", + }}) } } if v := env.Get(ctx, "DATABRICKS_CLUSTER_ID"); v != "" { // For historical reasons, we allow setting the cluster ID via the DATABRICKS_CLUSTER_ID // when development mode is used. Sometimes, this is done by accident, so we log an info message. if b.Config.Bundle.Mode == config.Development { - cmdio.LogString(ctx, "Overriding compute because DATABRICKS_CLUSTER_ID is set. It is recommended to use --cluster-id instead, which works in any target mode.") + cmdio.LogString(ctx, "Setting a cluster override because DATABRICKS_CLUSTER_ID is set. It is recommended to use --cluster-id instead, which works in any target mode.") } else { // We don't allow using DATABRICKS_CLUSTER_ID in any other mode, it's too error-prone. return diag.Warningf("The DATABRICKS_CLUSTER_ID variable is set but is ignored since the current target does not use 'mode: development'") diff --git a/bundle/config/mutator/override_compute_test.go b/bundle/config/mutator/override_compute_test.go index 717cea9f4..950091ed7 100644 --- a/bundle/config/mutator/override_compute_test.go +++ b/bundle/config/mutator/override_compute_test.go @@ -172,7 +172,7 @@ func TestOverrideComputeModeProduction(t *testing.T) { m := mutator.OverrideCompute() diags := bundle.Apply(context.Background(), b, m) require.Len(t, diags, 1) - assert.Equal(t, "Overriding compute for a target that uses 'mode: production' is not recommended", diags[0].Summary) + assert.Equal(t, "Setting a cluster override for a target that uses 'mode: production' is not recommended", diags[0].Summary) assert.Equal(t, "newClusterID", b.Config.Resources.Jobs["job1"].Tasks[0].ExistingClusterId) }