-
Notifications
You must be signed in to change notification settings - Fork 154
Fix bundle plan to not create workspace objects or upload the files
#3442
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
3a40b03
b52e57f
55f0f63
6c3eaaa
22a6ea6
e4e0f78
616a9a6
6d20505
74aa434
3a8e018
7fb9bfc
7fdf47a
5eeb08d
cb062a6
233ecd5
4b15de3
7db75a5
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 |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| bundle: | ||
|
Contributor
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. For more comprehensive test, can we add "bundle plan" + request recording to default-python various local and integration tests and check that there are no side effects there?
Contributor
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. I tried to include |
||
| name: plan-no-upload | ||
|
|
||
| resources: | ||
| jobs: | ||
| my_job: | ||
| name: my-job | ||
| tasks: | ||
| - task_key: task1 | ||
| spark_python_task: | ||
| python_file: "./my_script.py" | ||
| environment_key: "env" | ||
|
|
||
| environments: | ||
| - environment_key: "env" | ||
| spec: | ||
| client: "1" | ||
| dependencies: | ||
| - "*.whl" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| print("Hello, World!") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Local = true | ||
| Cloud = false | ||
|
|
||
| [EnvMatrix] | ||
| DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
|
|
||
| >>> [CLI] bundle plan | ||
| create jobs.my_job | ||
|
|
||
| >>> jq -s .[] | select(.method != "GET") out.requests.txt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| trace $CLI bundle plan | ||
|
|
||
| # Expect no non-GET requests | ||
| trace jq -s '.[] | select(.method != "GET")' out.requests.txt | ||
|
|
||
| rm out.requests.txt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Local = true | ||
| Cloud = false | ||
| RecordRequests = true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ package libraries | |
| import ( | ||
| "context" | ||
| "path" | ||
| "strings" | ||
|
|
||
| "github.com/databricks/cli/bundle" | ||
| "github.com/databricks/cli/libs/diag" | ||
|
|
@@ -24,6 +25,7 @@ func GetFilerForLibraries(ctx context.Context, b *bundle.Bundle) (filer.Filer, s | |
| } | ||
|
|
||
| uploadPath := path.Join(b.Config.Workspace.ArtifactPath, InternalDirName) | ||
| uploadPath = ensureWorkspaceOrVolumesPrefix(uploadPath) | ||
|
Contributor
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. Could you add a comment why this is needed? Unclear why we would be missing prefix now.
Contributor
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. Added, it's not that we miss it now, I just moved it from the other place to here, but I added the comment to the function |
||
|
|
||
| switch { | ||
| case IsVolumesPath(artifactPath): | ||
|
|
@@ -40,11 +42,23 @@ func GetFilerForLibrariesCleanup(ctx context.Context, b *bundle.Bundle) (filer.F | |
| return nil, "", diag.Errorf("remote artifact path not configured") | ||
| } | ||
|
|
||
| artifactPath = ensureWorkspaceOrVolumesPrefix(artifactPath) | ||
|
|
||
| switch { | ||
| case IsVolumesPath(artifactPath): | ||
| return filerForVolume(b, b.Config.Workspace.ArtifactPath) | ||
| return filerForVolume(b, artifactPath) | ||
|
|
||
| default: | ||
| return filerForWorkspace(b, b.Config.Workspace.ArtifactPath) | ||
| return filerForWorkspace(b, artifactPath) | ||
| } | ||
| } | ||
|
|
||
| // If the remote path does not start with /Workspace or /Volumes, prepend /Workspace | ||
| // Some of the bundle configuration might use workspace paths like /Users or /Shared. | ||
| // While this is still a valid workspace path, the backend converts it to /Workspace/Users or /Workspace/Shared. | ||
| func ensureWorkspaceOrVolumesPrefix(path string) string { | ||
| if !strings.HasPrefix(path, "/Workspace") && !strings.HasPrefix(path, "/Volumes") { | ||
| path = "/Workspace" + path | ||
| } | ||
| return path | ||
| } | ||
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.
The order is changed because now we set wheel wrapper earlier then we do artifacts cleanup