Skip to content

Commit 1ea1e79

Browse files
committed
Merge remote-tracking branch 'origin/main' into simonfaltum/auth-picker-search-mode
# Conflicts: # NEXT_CHANGELOG.md # cmd/auth/profile_picker.go
2 parents 6759e40 + 83efe60 commit 1ea1e79

32 files changed

Lines changed: 712 additions & 149 deletions

File tree

NEXT_CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# NEXT CHANGELOG
22

3-
## Release v0.300.0
3+
## Release v0.299.2
44

55
### CLI
66

@@ -10,6 +10,7 @@
1010

1111
### Bundles
1212

13+
* Propagate authentication environment (including `DATABRICKS_CONFIG_PROFILE`) to the `experimental.python` subprocess so bundle validate/deploy no longer fails with a multi-profile host ambiguity error when several profiles in `~/.databrickscfg` share the same host.
1314
* Fixed `--force-pull` on `bundle summary` and `bundle open` so the flag bypasses the local state cache and reads state from the workspace.
1415

1516
### Dependency updates

acceptance/bin/echo_browser.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Fake browser that prints the URL it was asked to open and exits.
4+
5+
Used by acceptance tests that exercise commands which call libs/browser.Open
6+
but don't need to follow the URL (unlike auth tests, which use browser.py to
7+
close the OAuth callback loop). Setting BROWSER=echo_browser.py is portable
8+
across darwin/linux/windows because libs/browser routes through libs/exec.
9+
10+
Usage: echo_browser.py <url>
11+
"""
12+
13+
import sys
14+
15+
if len(sys.argv) < 2:
16+
sys.stderr.write("Usage: echo_browser.py <url>\n")
17+
sys.exit(1)
18+
19+
print(sys.argv[1])

acceptance/bundle/open/open

Lines changed: 0 additions & 2 deletions
This file was deleted.

acceptance/bundle/open/out.test.toml

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acceptance/bundle/open/output.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ Deploying resources...
1717
Updating deployment state...
1818
Deployment complete!
1919

20-
=== Modify PATH so that real open is not run
21-
=== open after deployment. This will fail to open browser and complain, that's ok, we only want the message
20+
=== Use a fake browser that just prints the URL it would have opened
21+
=== open after deployment
2222
>>> [CLI] bundle open foo
2323
Opening browser at [DATABRICKS_URL]/jobs/[NUMID]?o=[NUMID]
24-
Error: exec: "open": cannot run executable found relative to current directory
24+
[DATABRICKS_URL]/jobs/[NUMID]?o=[NUMID]
2525

2626
=== test auto-completion handler
2727
>>> [CLI] __complete bundle open ,

acceptance/bundle/open/script

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ errcode trace $CLI bundle open foo
66

77
errcode trace $CLI bundle deploy
88

9-
title "Modify PATH so that real open is not run"
10-
export PATH=.:$PATH
9+
title "Use a fake browser that just prints the URL it would have opened"
10+
export BROWSER="echo_browser.py"
1111

12-
title "open after deployment. This will fail to open browser and complain, that's ok, we only want the message"
13-
musterr trace $CLI bundle open foo
12+
title "open after deployment"
13+
trace $CLI bundle open foo
1414

1515
title "test auto-completion handler"
1616
trace $CLI __complete bundle open ,

acceptance/bundle/open/test.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[my-profile]
2+
host = $DATABRICKS_HOST
3+
token = $DATABRICKS_TOKEN
4+
5+
[other-profile]
6+
host = $DATABRICKS_HOST
7+
token = other-token
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
bundle:
2+
name: my_project
3+
4+
sync: {paths: []} # don't need to copy files
5+
6+
python:
7+
mutators:
8+
- "mutators:capture_profile_env"
9+
10+
workspace:
11+
profile: my-profile
12+
13+
resources:
14+
jobs:
15+
my_job:
16+
name: "Job"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from databricks.bundles.jobs import Job
2+
from databricks.bundles.core import job_mutator, Bundle
3+
import os
4+
5+
6+
@job_mutator
7+
def capture_profile_env(bundle: Bundle, job: Job) -> Job:
8+
# The CLI must propagate DATABRICKS_CONFIG_PROFILE to the python subprocess
9+
# so the Databricks SDK can disambiguate when multiple profiles share a host.
10+
value = os.getenv("DATABRICKS_CONFIG_PROFILE", "<unset>")
11+
with open("captured_env.txt", "w") as f:
12+
f.write(value)
13+
return job

0 commit comments

Comments
 (0)