-
Notifications
You must be signed in to change notification settings - Fork 154
Added 'databricks bundle plan' command #3530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c1edf45
Added 'databricks bundle plan' command
andrewnester 95ce3a0
added changelog
andrewnester 544e53b
update changelog
andrewnester e0f251d
fixed test output
andrewnester 16b6788
fix lint
andrewnester ab1b7ca
Update NEXT_CHANGELOG.md (typo)
denik 7864b84
Merge branch 'main' into feat/bundle-plan
andrewnester ebdedad
Merge branch 'main' into feat/bundle-plan
andrewnester 59df028
fix fmt
andrewnester dd57b63
allow json flag
andrewnester 64e25ea
move json plan to debug
andrewnester 09e6f79
fix test output
andrewnester File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package debug | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "fmt" | ||
|
|
||
| "github.com/databricks/cli/cmd/bundle/utils" | ||
| "github.com/databricks/cli/cmd/root" | ||
| "github.com/databricks/cli/libs/logdiag" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| func NewPlanCommand() *cobra.Command { | ||
| return &cobra.Command{ | ||
| Use: "plan", | ||
| Short: "Show deployment plan in JSON format (experimental)", | ||
| Long: "Show the deployment plan for the current bundle configuration. This command is experimental and may change without notice.", | ||
| Args: root.NoArgs, | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| ctx := logdiag.InitContext(cmd.Context()) | ||
| cmd.SetContext(ctx) | ||
| b := utils.ConfigureBundleWithVariables(cmd) | ||
| if b == nil || logdiag.HasError(ctx) { | ||
| return root.ErrAlreadyPrinted | ||
| } | ||
| plan, err := utils.GetPlan(ctx, b) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| out := cmd.OutOrStdout() | ||
|
|
||
| buf, err := json.MarshalIndent(plan, "", " ") | ||
| if err != nil { | ||
| return err | ||
| } | ||
| fmt.Fprintln(out, string(buf)) | ||
| if logdiag.HasError(ctx) { | ||
| return root.ErrAlreadyPrinted | ||
| } | ||
| return nil | ||
| }, | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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:
It seems odd that it uploads artifacts as a side effect(edit: this appears to be fixed in Fixbundle planto not create workspace objects or upload the files #3442)Plan: 2 to add, 0 to change, 2 to destroy)?databricks bundle destroy?We need to be certain of the interface before making it public
cc @denik
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
deleteis 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 instone.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
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
(I'd also be up for variations of this exact output, but I'm proposing example output to try close on this.)
There was a problem hiding this comment.
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