-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not replace pipeline libraries if there are no matches for pattern (…
…#1021) ## Changes If there are no matches when doing Glob call for pipeline library defined, leave the entry as is. The next mutators in the chain will detect that file is missing and the error will be more user friendly. Before the change ``` Starting resource deployment Error: terraform apply: exit status 1 Error: cannot create pipeline: libraries must contain at least one element ``` After ``` Error: notebook ./non-existent not found ``` ## Tests Added regression unit tests
- Loading branch information
1 parent
5431174
commit 833746c
Showing
5 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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,12 @@ | ||
bundle: | ||
name: pipeline_glob_paths | ||
|
||
resources: | ||
pipelines: | ||
nyc_taxi_pipeline: | ||
name: "nyc taxi loader" | ||
libraries: | ||
- notebook: | ||
path: ./dlt/* | ||
- notebook: | ||
path: ./non-existent |
3 changes: 3 additions & 0 deletions
3
bundle/tests/bundle/pipeline_glob_paths/dlt/nyc_taxi_loader.py
This file contains 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,3 @@ | ||
# Databricks notebook source | ||
|
||
print("Hello from notebook!") |
This file contains 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,40 @@ | ||
package bundle | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/databricks/cli/bundle" | ||
"github.com/databricks/cli/bundle/config" | ||
"github.com/databricks/cli/bundle/config/mutator" | ||
"github.com/databricks/cli/bundle/phases" | ||
"github.com/databricks/cli/cmd/root" | ||
"github.com/databricks/databricks-sdk-go/service/iam" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestExpandPipelineGlobPathsWithNonExistent(t *testing.T) { | ||
ctx := context.Background() | ||
ctx = root.SetWorkspaceClient(ctx, nil) | ||
|
||
b, err := bundle.Load(ctx, "./pipeline_glob_paths") | ||
require.NoError(t, err) | ||
|
||
err = bundle.Apply(ctx, b, bundle.Seq(mutator.DefaultMutators()...)) | ||
require.NoError(t, err) | ||
b.Config.Bundle.Target = "default" | ||
|
||
b.Config.Workspace.CurrentUser = &config.User{User: &iam.User{UserName: "user@domain.com"}} | ||
b.WorkspaceClient() | ||
|
||
m := phases.Initialize() | ||
err = bundle.Apply(ctx, b, m) | ||
require.Error(t, err) | ||
require.ErrorContains(t, err, "notebook ./non-existent not found") | ||
|
||
require.Equal( | ||
t, | ||
b.Config.Resources.Pipelines["nyc_taxi_pipeline"].Libraries[0].Notebook.Path, | ||
"/Users/user@domain.com/.bundle/pipeline_glob_paths/default/files/dlt/nyc_taxi_loader", | ||
) | ||
} |