diff --git a/acceptance/pipelines/run/run-pipeline/databricks.yml b/acceptance/pipelines/run/run-pipeline/databricks.yml index e94d63b3b9..f192a4d183 100644 --- a/acceptance/pipelines/run/run-pipeline/databricks.yml +++ b/acceptance/pipelines/run/run-pipeline/databricks.yml @@ -8,3 +8,7 @@ resources: libraries: - file: path: pipeline_file.py + # job is runnable, but doesn't impact auto-selection of pipeline + jobs: + my_job: + name: "My Job" diff --git a/acceptance/pipelines/run/run-pipeline/output.txt b/acceptance/pipelines/run/run-pipeline/output.txt index ff7ead7e5d..711799b4ec 100644 --- a/acceptance/pipelines/run/run-pipeline/output.txt +++ b/acceptance/pipelines/run/run-pipeline/output.txt @@ -4,6 +4,7 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-pipeline-run/ Deploying resources... Updating deployment state... Deployment complete! +View your job my_job here: [DATABRICKS_URL]/jobs/[NUMID]?o=[NUMID] View your pipeline my_pipeline here: [DATABRICKS_URL]/pipelines/[UUID]?o=[NUMID] === Run pipeline diff --git a/cmd/pipelines/run.go b/cmd/pipelines/run.go index 6552ffd110..32fdd612ba 100644 --- a/cmd/pipelines/run.go +++ b/cmd/pipelines/run.go @@ -351,7 +351,7 @@ Refreshes all tables in the pipeline unless otherwise specified.`, } if len(args) == 0 { - completions := bundleresources.Completions(b, run.IsRunnable) + completions := bundleresources.Completions(b, isPipeline) return maps.Keys(completions), cobra.ShellCompDirectiveNoFileComp } else { // If we know the resource to run, we can complete additional positional arguments. diff --git a/cmd/pipelines/utils.go b/cmd/pipelines/utils.go index 3b99a6c043..984da2d6af 100644 --- a/cmd/pipelines/utils.go +++ b/cmd/pipelines/utils.go @@ -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) 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 + } +}