-
Notifications
You must be signed in to change notification settings - Fork 133
pipelines: fix auto-selection in "pipelines run" #4245
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,12 +42,10 @@ func promptResource(ctx context.Context, b *bundle.Bundle, filters ...resources. | |
| // autoSelectSinglePipeline checks if there's exactly one pipeline resource in the bundle and returns its key. | ||
| // Returns empty string if there's not exactly one pipeline. | ||
| func autoSelectSinglePipeline(b *bundle.Bundle) string { | ||
| completions := resources.Completions(b, run.IsRunnable) | ||
| completions := resources.Completions(b, isPipeline) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just a drive by comment since I got tagged: this was an intentional decision at the time from some one-off discussion. I think the product decision at the time was to still to expose anything that can still be run. Just curious if we've changed this decision.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our template includes a job and a pipeline, so "run" command doesn't work because there are 2 runnable resources. Given that we are exposing the same "run" command in "databricks pipelines run", it should behave differently from "databricks bundles run", similar to how "databricks app run" and "databricks jobs run" should filter by their resource type. |
||
| if len(completions) == 1 { | ||
| for key, ref := range completions { | ||
| if _, ok := ref.Resource.(*configresources.Pipeline); ok { | ||
| return key | ||
| } | ||
| for key := range completions { | ||
| return key | ||
| } | ||
| } | ||
| return "" | ||
|
|
@@ -334,3 +332,12 @@ func fetchPipelineUpdates(ctx context.Context, w *databricks.WorkspaceClient, st | |
|
|
||
| return updates, nil | ||
| } | ||
|
|
||
| func isPipeline(ref resources.Reference) bool { | ||
| switch ref.Resource.(type) { | ||
| case *configresources.Pipeline: | ||
| return true | ||
| default: | ||
| return false | ||
| } | ||
| } | ||
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.
Non-blocking: I don't think we should show all URLs for many-resource DABs projects. We still don't have a good "single" URL for deployments yet. The alternative I think we discussed way back was to show a hint to use the
summarycommand whenever there is >1 resource. But 1 pipeline + 1 job could also be treated as a special case.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.
Makes sense. Do I understand correctly, that this suggestion applies generically to DABs, and not special to pipelines?