Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
### Bundles

* engine/direct: Added support for Vector Search Endpoints ([#4887](https://github.com/databricks/cli/pull/4887))
* Fixed `--force-pull` on `bundle summary` and `bundle open` so the flag bypasses the local state cache and reads state from the workspace.

### Dependency updates

Expand Down
16 changes: 16 additions & 0 deletions acceptance/bundle/state/force_pull_commands/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
bundle:
name: force-pull-commands

resources:
jobs:
foo:
name: foo
tasks:
- task_key: task
spark_python_task:
python_file: ./foo.py
environment_key: default
environments:
- environment_key: default
spec:
client: "2"
1 change: 1 addition & 0 deletions acceptance/bundle/state/force_pull_commands/foo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("hello")
2 changes: 2 additions & 0 deletions acceptance/bundle/state/force_pull_commands/open
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "I AM BROWSER"
9 changes: 9 additions & 0 deletions acceptance/bundle/state/force_pull_commands/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions acceptance/bundle/state/force_pull_commands/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/force-pull-commands/default/files...
Deploying resources...
Updating deployment state...
Deployment complete!

=== Modify PATH so that real open is not run
=== bundle summary without --force-pull: no remote state read

>>> [CLI] bundle summary

=== bundle summary --force-pull: remote state read

>>> [CLI] bundle summary --force-pull
{
"method": "GET",
"path": "/api/2.0/workspace-files/Workspace/Users/[USERNAME]/.bundle/force-pull-commands/default/state/STATE_FILENAME"
}

=== bundle open without --force-pull: no remote state read

>>> [CLI] bundle open foo
Opening browser at [DATABRICKS_URL]/jobs/[NUMID]?o=[NUMID]
Error: exec: "open": cannot run executable found relative to current directory

=== bundle open --force-pull: remote state read

>>> [CLI] bundle open foo --force-pull
Opening browser at [DATABRICKS_URL]/jobs/[NUMID]?o=[NUMID]
Error: exec: "open": cannot run executable found relative to current directory
{
"method": "GET",
"path": "/api/2.0/workspace-files/Workspace/Users/[USERNAME]/.bundle/force-pull-commands/default/state/STATE_FILENAME"
}
21 changes: 21 additions & 0 deletions acceptance/bundle/state/force_pull_commands/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
trace $CLI bundle deploy > /dev/null
rm -f out.requests.txt

title "Modify PATH so that real open is not run"
export PATH=.:$PATH

title "bundle summary without --force-pull: no remote state read\n"
trace $CLI bundle summary > /dev/null
print_requests.py --get //workspace-files/

title "bundle summary --force-pull: remote state read\n"
trace $CLI bundle summary --force-pull > /dev/null
print_requests.py --get //workspace-files/

title "bundle open without --force-pull: no remote state read\n"
musterr trace $CLI bundle open foo > /dev/null
print_requests.py --get //workspace-files/

title "bundle open --force-pull: remote state read\n"
musterr trace $CLI bundle open foo --force-pull > /dev/null
print_requests.py --get //workspace-files/
17 changes: 17 additions & 0 deletions acceptance/bundle/state/force_pull_commands/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Local = true
Cloud = false
RecordRequests = true

# bundle open opens a browser; restrict to darwin to get stable output
# (mirrors acceptance/bundle/open/test.toml).
GOOS.windows = false
GOOS.linux = false

Ignore = [".databricks"]

[EnvMatrix]
DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"]

[[Repls]]
Old = '(resources\.json|terraform\.tfstate)'
New = 'STATE_FILENAME'
3 changes: 2 additions & 1 deletion cmd/bundle/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ Use after deployment to quickly navigate to your resources in the workspace.`,
arg, err = resolveOpenArgument(ctx, b, args)
return err
},
InitIDs: true,
AlwaysPull: forcePull,
InitIDs: true,
})
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions cmd/bundle/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Useful after deployment to see what was created and where to find it.`,
} else {
b, err := utils.ProcessBundle(cmd, utils.ProcessOptions{
ReadState: true,
AlwaysPull: forcePull,
IncludeLocations: includeLocations,
InitIDs: true,
})
Expand Down
Loading