Skip to content

Conversation

andrewnester
Copy link
Contributor

@andrewnester andrewnester commented Sep 1, 2025

Changes

Made 'databricks bundle plan' command public (previously hidden)

Why

This command builds the bundle and displays the actions that will be performed on the deployed resources without making any changes.
It is useful for previewing changes before running bundle deploy.
The output of the command is high level list of actions and resources which are changed, for example

>>> databricks bundle plan

create job.my_project_job
delete job.sample_job
create pipeline.my_project_pipeline
delete pipeline.sample_etl

Plan: 2 to add, 0 to change, 2 to delete, 3 unchanged

Tests

Covered by existing tests

cmd.Flags().StringVarP(&clusterId, "cluster-id", "c", "", "Override cluster in the deployment with the given cluster ID.")
cmd.Flags().MarkDeprecated("compute-id", "use --cluster-id instead")

cmd.PreRunE = func(cmd *cobra.Command, args []string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick question - why it is in PreRunE and not RunE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to separate these two and run the check earlier

@eng-dev-ecosystem-bot
Copy link
Collaborator

eng-dev-ecosystem-bot commented Sep 1, 2025

Run: 17975134246

Env ✅​pass 🙈​skip
✅​ aws linux 311 529
✅​ aws windows 312 528
✅​ aws-ucws linux 423 427
✅​ aws-ucws windows 424 426
✅​ azure linux 311 528
✅​ azure windows 312 527
✅​ azure-ucws linux 423 426
✅​ azure-ucws windows 424 425
✅​ gcp linux 310 530
✅​ gcp windows 311 529


func newPlanCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "plan",
Copy link
Contributor

@lennartkats-db lennartkats-db Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the exact expected behavior of bundle plan?

Running it locally:

$ databricks bundle plan
Building python_artifact...
Uploading dist/my_project-0.0.1-py3-none-any.whl...
create jobs.my_project_job
delete jobs.sample_job
create pipelines.my_project_pipeline
delete pipelines.sample_etl
  • It seems odd that it builds artifacts as a side effect (but maybe this is necessary?)
  • It seems odd that it uploads artifacts as a side effect (edit: this appears to be fixed in Fix bundle plan to not create workspace objects or upload the files #3442)
  • Should there not be a summary line, like in Terraform (Plan: 2 to add, 0 to change, 2 to destroy)?
  • Should we not use the term "destroy" instead of "delete"? Since that is also the term used for the databricks bundle destroy?

We need to be certain of the interface before making it public

cc @denik

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building an artifact is unfortunately required, because we don't know the final filename of the artifact and we need that filename in the resource configuration.

Uploading the artifact is certainly a bug and we should have acceptance test + fix for it. I think we should fix it before the release.

Summary is nice to have but could be a follow up.

Regarding delete/destroy, this is not new, this is what DABs always used in other places:

The following resources will be deleted:
  delete app myapp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lennartkats-db are you sure you're using latest main? Not uploading artifacts as part of the plan was fixed here #3442

Copy link
Contributor

@lennartkats-db lennartkats-db Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, yes, I'm not using the latest main, good to see uploading is fixed.

It still seems to build the artifact though, but I suppose that might be necessary? It's quite unfortunate it prints a message about but if it is necessary then it should offer that transparency.

And delete is indeed used in other places. I also kind of like that word. But we should treat this moment as the time where we decide to cast that in
stone.

The summary I'd really want to have and seems easy to add.

One more observation: the output of the command should go to stdout, not stderr.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not use the term "destroy" instead of "delete"? Since that is also the term used for the databricks bundle destroy?

Deletion can happen as a result of "bundle deploy" as well. It's a more specific and recognizable term IMO. All APIs and SDKs call call this deletion, not destruction.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. So how about

So output could look like

$ databricks bundle plan
Building python_artifact...  ### this would still go to stderr
Plan: 2 to add, 0 to change, 2 to delete
  create jobs.my_project_job
  delete jobs.sample_job
  create pipelines.my_project_pipeline
  delete pipelines.sample_etl

(I'd also be up for variations of this exact output, but I'm proposing example output to try close on this.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's PR to improve the plan output #3546

@andrewnester andrewnester added this pull request to the merge queue Sep 24, 2025
Merged via the queue into main with commit d78f88f Sep 24, 2025
13 checks passed
@andrewnester andrewnester deleted the feat/bundle-plan branch September 24, 2025 13:11
deco-sdk-tagging bot added a commit that referenced this pull request Sep 24, 2025
## Release v0.270.0

### Notable Changes
* Add 'databricks bundle plan' command. This command shows the deployment plan for the current bundle configuration without making any changes. ([#3530](#3530))

### Bundles
* Add 'databricks bundle plan' command ([#3530](#3530))
* Add new Lakeflow Pipelines support for bundle generate ([#3568](#3568))
* Fix bundle deploy to not update permissions or grants for unbound resources ([#3642](#3642))
* Introduce new bundle variable: `${workspace.current_user.domain_friendly_name}` ([#3623](#3623))
* Improve the output of bundle run when bundle is not deployed ([#3652](#3652))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants