Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Marked the default profile in the interactive pickers shown by `databricks auth switch`, `databricks auth logout`, `databricks auth token`, and `databricks auth login`, and moved it to the top of the list. `databricks auth login` and `databricks auth logout` now offer the same selectors as `databricks auth token` and `databricks auth switch` respectively.

### Bundles
* Make sure warnings asking for approval are understood by agents ([#5239](https://github.com/databricks/cli/pull/5239))
* Stop applying `presets.name_prefix` (and the dev-mode `[dev <user>]` rename) to `vector_search_endpoints` ([#5209](https://github.com/databricks/cli/pull/5209)).

* Fix `bundle generate` job to preserve nested notebook directory structure ([#4596](https://github.com/databricks/cli/pull/4596))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQU
This action will result in the deletion or recreation of the following dashboards.
This will result in changed IDs and permanent URLs of the dashboards that will be recreated:
recreate resources.dashboards.dashboard1
Error: the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed
Error: the deployment requires destructive actions, but the current console does not support prompting.
Deleting data assets such as schemas, pipelines, or volumes may cause permanent data loss and should be carefully reviewed.
To proceed, use --auto-approve after reviewing the plan above.


Exit code: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
Created job with ID: [JOB_ID]

=== Expect binding to fail without an auto-approve flag:
Error: This bind operation requires user confirmation, but the current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed.
Error: this bind operation requires user confirmation, but the current console does not support prompting.
To proceed, use --auto-approve after reviewing the plan above.


Exit code: 1

=== Deploy bundle:
>>> [CLI] bundle deploy --force-lock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ trap cleanup EXIT

title "Expect binding to fail without an auto-approve flag:\n"
trace errcode $CLI bundle deployment bind foo $JOB_ID &> out.bind-result.txt
grep "^Error:" out.bind-result.txt
sed -n '/^Error:/,$p' out.bind-result.txt
rm out.bind-result.txt

title "Deploy bundle:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ Changes detected:
~ root_path: "/Workspace/Users/someuser@databricks.com/lakeflow_pipeline" -> null
~ storage: "/Shared/old_storage" -> "/Shared/new_storage"

Error: This bind operation requires user confirmation, but the current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed.
Error: this bind operation requires user confirmation, but the current console does not support prompting.
To proceed, use --auto-approve after reviewing the plan above.

Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ Terraform will perform the following actions:
Plan: 1 to add, 0 to change, 1 to destroy.


Error: This bind operation requires user confirmation, but the current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed.
Error: this bind operation requires user confirmation, but the current console does not support prompting.
To proceed, use --auto-approve after reviewing the plan above.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Streaming Tables (STs) and Materialized Views (MVs) managed by them. Recreating
restore the defined STs and MVs through full refresh. Note that recreation is necessary when pipeline
properties such as the 'catalog' or 'storage' are changed:
recreate resources.pipelines.foo
Error: the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed
Error: the deployment requires destructive actions, but the current console does not support prompting.
Deleting data assets such as schemas, pipelines, or volumes may cause permanent data loss and should be carefully reviewed.
To proceed, use --auto-approve after reviewing the plan above.


>>> [CLI] bundle deploy --auto-approve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ Changes detected:
~ name: "lakeflow-pipeline" -> "test-pipeline"
~ root_path: "/Workspace/Users/[USERNAME]/lakeflow_pipeline" -> null

Error: This bind operation requires user confirmation, but the current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed.
Error: this bind operation requires user confirmation, but the current console does not support prompting.
To proceed, use --auto-approve after reviewing the plan above.

Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ Terraform will perform the following actions:
Plan: 0 to add, 1 to change, 0 to destroy.


Error: This bind operation requires user confirmation, but the current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed.
Error: this bind operation requires user confirmation, but the current console does not support prompting.
To proceed, use --auto-approve after reviewing the plan above.

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ These modifications are untracked and will be overwritten on deploy.
Make sure that the local dashboard definition matches what you intend to deploy
before proceeding with the deployment.

Run `databricks bundle deploy --force` to bypass this error.
To overwrite the remote changes with your local version, use --force.
The remote modifications will be lost.

update dashboards.file_reference

Expand All @@ -77,7 +78,8 @@ These modifications are untracked and will be overwritten on deploy.
Make sure that the local dashboard definition matches what you intend to deploy
before proceeding with the deployment.

Run `databricks bundle deploy --force` to bypass this error.
To overwrite the remote changes with your local version, use --force.
The remote modifications will be lost.


>>> errcode [CLI] bundle deploy
Expand All @@ -91,7 +93,8 @@ These modifications are untracked and will be overwritten on deploy.
Make sure that the local dashboard definition matches what you intend to deploy
before proceeding with the deployment.

Run `databricks bundle deploy --force` to bypass this error.
To overwrite the remote changes with your local version, use --force.
The remote modifications will be lost.


Exit code: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ Streaming Tables (STs) and Materialized Views (MVs) managed by them. Recreating
restore the defined STs and MVs through full refresh. Note that recreation is necessary when pipeline
properties such as the 'catalog' or 'storage' are changed:
delete resources.pipelines.bar
Error: the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed
Error: the deployment requires destructive actions, but the current console does not support prompting.
Deleting data assets such as schemas, pipelines, or volumes may cause permanent data loss and should be carefully reviewed.
To proceed, use --auto-approve after reviewing the plan above.


Exit code: 1
Expand Down
4 changes: 3 additions & 1 deletion acceptance/bundle/resources/pipelines/recreate/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ Streaming Tables (STs) and Materialized Views (MVs) managed by them. Recreating
restore the defined STs and MVs through full refresh. Note that recreation is necessary when pipeline
properties such as the 'catalog' or 'storage' are changed:
recreate resources.pipelines.foo
Error: the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed
Error: the deployment requires destructive actions, but the current console does not support prompting.
Deleting data assets such as schemas, pipelines, or volumes may cause permanent data loss and should be carefully reviewed.
To proceed, use --auto-approve after reviewing the plan above.


Exit code: 1
Expand Down
4 changes: 3 additions & 1 deletion acceptance/bundle/resources/schemas/auto-approve/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/file

This action will result in the deletion or recreation of the following UC schemas. Any underlying data may be lost:
delete resources.schemas.bar
Error: the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed
Error: the deployment requires destructive actions, but the current console does not support prompting.
Deleting data assets such as schemas, pipelines, or volumes may cause permanent data loss and should be carefully reviewed.
To proceed, use --auto-approve after reviewing the plan above.


=== Test cleanup
Expand Down
6 changes: 4 additions & 2 deletions acceptance/bundle/resources/volumes/recreate/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Deployment complete!
{
"privilege_assignments": [
{
"principal":"account users",
"principal": "account users",
"privileges": [
"WRITE_VOLUME"
]
Expand All @@ -45,7 +45,9 @@ For managed volumes, the files stored in the volume are also deleted from your
cloud tenant within 30 days. For external volumes, the metadata about the volume
is removed from the catalog, but the underlying files are not deleted:
recreate resources.volumes.foo
Error: the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed
Error: the deployment requires destructive actions, but the current console does not support prompting.
Deleting data assets such as schemas, pipelines, or volumes may cause permanent data loss and should be carefully reviewed.
To proceed, use --auto-approve after reviewing the plan above.


Exit code: 1
Expand Down
4 changes: 3 additions & 1 deletion acceptance/pipelines/deploy/auto-approve/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ Streaming Tables (STs) and Materialized Views (MVs) managed by them. Recreating
restore the defined STs and MVs through full refresh. Note that recreation is necessary when pipeline
properties such as the 'catalog' or 'storage' are changed:
delete resources.pipelines.foo
Error: the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed
Error: the deployment requires destructive actions, but the current console does not support prompting.
Deleting data assets such as schemas, pipelines, or volumes may cause permanent data loss and should be carefully reviewed.
To proceed, use --auto-approve after reviewing the plan above.


Exit code: 1
Expand Down
8 changes: 6 additions & 2 deletions acceptance/pipelines/deploy/force-lock/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

=== test deployment without force-lock (should fail)
>>> errcode [CLI] pipelines deploy
Error: Failed to acquire deployment lock: deploy lock acquired by user-with-lock@databricks.com at [TIMESTAMP] +0000 UTC. Use --force-lock to override
Error: deploy lock acquired by user-with-lock@databricks.com at [TIMESTAMP] +0000 UTC. Use --force-lock to override
Error: Failed to acquire deployment lock: deploy lock acquired by user-with-lock@databricks.com at [TIMESTAMP] +0000 UTC.
Another deployment may be in progress. Use --force-lock to override, but this may
conflict with the other deployment if it is still active
Error: deploy lock acquired by user-with-lock@databricks.com at [TIMESTAMP] +0000 UTC.
Another deployment may be in progress. Use --force-lock to override, but this may
conflict with the other deployment if it is still active


Exit code: 1
Expand Down
4 changes: 3 additions & 1 deletion acceptance/pipelines/destroy/auto-approve/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Deployment complete!
View your pipeline my_pipeline here: [DATABRICKS_URL]/pipelines/[UUID]?o=[NUMID]

>>> errcode [CLI] pipelines destroy
Error: please specify --auto-approve since terminal does not support interactive prompts
Error: this command will destroy all resources deployed by this bundle, including workspace files in the deployment directory.
Deleting data assets such as schemas, pipelines, or volumes may cause permanent data loss and should be carefully reviewed.
To proceed, use --auto-approve.

Exit code: 1

Expand Down
8 changes: 6 additions & 2 deletions acceptance/pipelines/destroy/force-lock/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ View your pipeline foo here: [DATABRICKS_URL]/pipelines/[UUID]?o=[NUMID]

=== test deployment without force-lock (should fail)
>>> errcode [CLI] pipelines destroy --auto-approve
Error: Failed to acquire deployment lock: deploy lock acquired by user-with-lock@databricks.com at [TIMESTAMP] +0000 UTC. Use --force-lock to override
Error: deploy lock acquired by user-with-lock@databricks.com at [TIMESTAMP] +0000 UTC. Use --force-lock to override
Error: Failed to acquire deployment lock: deploy lock acquired by user-with-lock@databricks.com at [TIMESTAMP] +0000 UTC.
Another deployment may be in progress. Use --force-lock to override, but this may
conflict with the other deployment if it is still active
Error: deploy lock acquired by user-with-lock@databricks.com at [TIMESTAMP] +0000 UTC.
Another deployment may be in progress. Use --force-lock to override, but this may
conflict with the other deployment if it is still active


Exit code: 1
Expand Down
4 changes: 3 additions & 1 deletion bundle/config/mutator/validate_git_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"github.com/databricks/cli/bundle"
"github.com/databricks/cli/libs/agent"
"github.com/databricks/cli/libs/diag"
)

Expand All @@ -23,7 +24,8 @@ func (m *validateGitDetails) Apply(ctx context.Context, b *bundle.Bundle) diag.D
}

if b.Config.Bundle.Git.Branch != b.Config.Bundle.Git.ActualBranch && !b.Config.Bundle.Force {
return diag.Errorf("not on the right Git branch:\n expected according to configuration: %s\n actual: %s\nuse --force to override", b.Config.Bundle.Git.Branch, b.Config.Bundle.Git.ActualBranch)
return diag.Errorf("not on the right Git branch:\n expected according to configuration: %s\n actual: %s\nTo deploy from this branch anyway, use --force. Note that this may push unexpected code to the target.%s",
b.Config.Bundle.Git.Branch, b.Config.Bundle.Git.ActualBranch, agent.AgentNotice())
}
return nil
}
5 changes: 3 additions & 2 deletions bundle/config/mutator/validate_git_details_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ func TestValidateGitDetailsNonMatchingBranches(t *testing.T) {
m := ValidateGitDetails()
diags := bundle.Apply(t.Context(), b, m)

expectedError := "not on the right Git branch:\n expected according to configuration: main\n actual: feature\nuse --force to override"
assert.EqualError(t, diags.Error(), expectedError)
err := diags.Error()
assert.ErrorContains(t, err, "not on the right Git branch:\n expected according to configuration: main\n actual: feature")
assert.ErrorContains(t, err, "To deploy from this branch anyway, use --force. Note that this may push unexpected code to the target.")
}

func TestValidateGitDetailsNotUsingGit(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions bundle/deploy/terraform/check_dashboards_modified_remotely.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/databricks/cli/bundle"
"github.com/databricks/cli/bundle/config/engine"
"github.com/databricks/cli/libs/agent"
"github.com/databricks/cli/libs/diag"
"github.com/databricks/cli/libs/dyn"
)
Expand Down Expand Up @@ -120,8 +121,8 @@ func (l *checkDashboardsModifiedRemotely) Apply(ctx context.Context, b *bundle.B
"Make sure that the local dashboard definition matches what you intend to deploy\n" +
"before proceeding with the deployment.\n" +
"\n" +
"Run `databricks bundle deploy --force` to bypass this error." +
"",
"To overwrite the remote changes with your local version, use --force.\n" +
"The remote modifications will be lost." + agent.AgentNotice(),
Paths: []dyn.Path{path},
Locations: []dyn.Location{loc},
})
Expand Down
3 changes: 2 additions & 1 deletion bundle/deploy/terraform/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"strings"

"github.com/databricks/cli/bundle"
"github.com/databricks/cli/libs/agent"
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/diag"
"github.com/hashicorp/terraform-exec/tfexec"
Expand Down Expand Up @@ -72,7 +73,7 @@ func (m *importResource) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagn
cmdio.LogString(ctx, output)

if !cmdio.IsPromptSupported(ctx) {
return diag.Errorf("This bind operation requires user confirmation, but the current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed.")
return diag.Errorf("this bind operation requires user confirmation, but the current console does not support prompting.\nTo proceed, use --auto-approve after reviewing the plan above.%s", agent.AgentNotice())
}

ans, err := cmdio.AskYesOrNo(ctx, "Confirm import changes? Changes will be remotely applied only after running 'bundle deploy'.")
Expand Down
3 changes: 2 additions & 1 deletion bundle/phases/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/databricks/cli/bundle/deploy/terraform"
"github.com/databricks/cli/bundle/deployplan"
"github.com/databricks/cli/bundle/statemgmt"
"github.com/databricks/cli/libs/agent"
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/log"
"github.com/databricks/cli/libs/logdiag"
Expand Down Expand Up @@ -68,7 +69,7 @@ func Bind(ctx context.Context, b *bundle.Bundle, opts *terraform.BindOptions, en

if !cmdio.IsPromptSupported(ctx) {
result.Cancel()
logdiag.LogError(ctx, errors.New("This bind operation requires user confirmation, but the current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed.")) //nolint
logdiag.LogError(ctx, fmt.Errorf("this bind operation requires user confirmation, but the current console does not support prompting.\nTo proceed, use --auto-approve after reviewing the plan above.%s", agent.AgentNotice()))
return
}

Expand Down
5 changes: 4 additions & 1 deletion bundle/phases/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/databricks/cli/bundle/permissions"
"github.com/databricks/cli/bundle/scripts"
"github.com/databricks/cli/bundle/statemgmt"
"github.com/databricks/cli/libs/agent"
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/log"
"github.com/databricks/cli/libs/logdiag"
Expand Down Expand Up @@ -56,7 +57,9 @@ func approvalForDeploy(ctx context.Context, b *bundle.Bundle, plan *deployplan.P
}

if !cmdio.IsPromptSupported(ctx) {
return false, errors.New("the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed")
return false, errors.New("the deployment requires destructive actions, but the current console does not support prompting.\n" +
DataLossWarning + "\n" +
"To proceed, use --auto-approve after reviewing the plan above." + agent.AgentNotice())
}

cmdio.LogString(ctx, "")
Expand Down
4 changes: 4 additions & 0 deletions bundle/phases/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ This action will result in the deletion or recreation of the following Lakebase
All data stored in them will be permanently lost:`
)

// DataLossWarning is the warning shown when a non-interactive command is about
// to delete data-bearing resources.
const DataLossWarning = "Deleting data assets such as schemas, pipelines, or volumes may cause permanent data loss and should be carefully reviewed."

// Messages for bundle destroy.
const (
deleteSchemaMessage = `This action will result in the deletion of the following UC schemas. Any underlying data may be lost:`
Expand Down
6 changes: 5 additions & 1 deletion cmd/bundle/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/databricks/cli/bundle/statemgmt"
"github.com/databricks/cli/cmd/bundle/utils"
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/agent"
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/logdiag"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -50,7 +51,10 @@ Typical use cases:
func CommandBundleDestroy(cmd *cobra.Command, args []string, autoApprove, forceDestroy bool) error {
// We require auto-approve for non-interactive terminals since prompts are not possible.
if !cmdio.IsPromptSupported(cmd.Context()) && !autoApprove {
return errors.New("please specify --auto-approve since terminal does not support interactive prompts")
return errors.New("this command will destroy all resources deployed by this bundle, " +
"including workspace files in the deployment directory.\n" +
phases.DataLossWarning + "\n" +
"To proceed, use --auto-approve." + agent.AgentNotice())
}

// Check if context is already initialized (e.g., when called from apps delete override)
Expand Down
Loading
Loading