Skip to content

Respect BROWSER environment variable in "auth login" command#3659

Merged
pietern merged 6 commits intomainfrom
auth-login-respect-browser-env
Oct 7, 2025
Merged

Respect BROWSER environment variable in "auth login" command#3659
pietern merged 6 commits intomainfrom
auth-login-respect-browser-env

Conversation

@pietern
Copy link
Contributor

@pietern pietern commented Sep 25, 2025

Changes

Respect the BROWSER environment variable for the OAuth login flow. When set, the value is used as executable to launch the URL to authenticate the user. When set to "none", the CLI prints a message with the URL to open. When not set, it defers to the existing logic to open a browser via the pkg/browser package.

Why

Context in:

Also refer to issues linked in the description of these issues for broader context, and why pkg/browser doesn't respect BROWSER itself. It boils down to it not being a ratified standard.

We choose to respect it to make the interactive login flow from VS Code running in a dev container work.

Tests

New acceptance test that goes through the login flow via the test server.

@eng-dev-ecosystem-bot
Copy link
Collaborator

eng-dev-ecosystem-bot commented Sep 25, 2025

Run: 18223507324

Env ✅​pass 🔄​flaky 🙈​skip
✅​ aws linux 320 538
🔄​ aws windows 317 4 537
✅​ aws-ucws linux 436 434
🔄​ aws-ucws windows 434 3 433
✅​ azure linux 320 537
✅​ azure windows 321 536
✅​ azure-ucws linux 436 433
✅​ azure-ucws windows 437 432
✅​ gcp linux 319 539
🔄​ gcp windows 318 2 538
9 failing tests:
Test Name aws windows aws-ucws windows gcp windows
TestAccept ✅​pass 🔄​flaky ✅​pass
TestAccept/bundle/deploy/dashboard/generate_inplace 🔄​flaky ✅​pass ✅​pass
TestAccept/bundle/deploy/pipeline/lakeflow-pipeline/DATABRICKS_BUNDLE_ENGINE=direct-exp ✅​pass ✅​pass 🔄​flaky
TestAccept/bundle/deploy/pipeline/lakeflow-pipeline/DATABRICKS_BUNDLE_ENGINE=terraform ✅​pass ✅​pass 🔄​flaky
TestAccept/bundle/deployment/bind/job/job-spark-python-task 🔄​flaky ✅​pass ✅​pass
TestAccept/bundle/templates/default-python/integration_classic ✅​pass 🔄​flaky ✅​pass
TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=terraform/UV_PYTHON=3.13 ✅​pass 🔄​flaky ✅​pass
TestFsCpDir 🔄​flaky ✅​pass ✅​pass
TestFsCpDir/dbfs_to_local 🔄​flaky ✅​pass ✅​pass

- Add error handling to browser.py test helper
- Add comprehensive documentation to getBrowserFunc()
- Remove unused mutex and LockUnlock method from FakeOidc
@pietern pietern temporarily deployed to test-trigger-is October 2, 2025 14:10 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is October 3, 2025 13:21 — with GitHub Actions Inactive
@pietern pietern requested a review from denik October 3, 2025 13:22
github-merge-queue bot pushed a commit that referenced this pull request Oct 6, 2025
## Changes

Move process replacement functionality from libs/exec to libs/execv to
separate concerns. The exec package now focuses on command execution,
while execv handles process replacement via syscalls.

Shell preparation code is extracted to prepare.go. ShellExecv is moved
to the execv package and renamed to Shell for clarity.

The next step is to also rename `exec` to something that implies
executing scripts through a shell.

## Why

I looked into the package while working on #3659 and found this could be
improved.
@pietern pietern temporarily deployed to test-trigger-is October 6, 2025 11:29 — with GitHub Actions Inactive
@pietern
Copy link
Contributor Author

pietern commented Oct 6, 2025

@denik Can you take another look?

@pietern
Copy link
Contributor Author

pietern commented Oct 6, 2025

@ilia-db Can you take a look?

@pietern pietern merged commit 9da7f7d into main Oct 7, 2025
12 checks passed
@pietern pietern deleted the auth-login-respect-browser-env branch October 7, 2025 08:34
sys.stderr.write(f"Failed to fetch URL: {url} ({e})\n")
sys.exit(1)

sys.exit(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not needed.

jq -r 'select(.path? == "/telemetry-ext") | (.body.protoLogs // [])[] | fromjson | ( (.entry // .) | (.databricks_cli_log.bundle_deploy_event.experimental.bool_values // []) ) | map("\(.key) \(.value)") | .[]' out.requests.txt | sort
}

sethome() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add it here if it's only used in one test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spent a few iterations figuring out why something was failing on Windows only to find out that the wrong $HOME-equivalent environment variable was set. With a helper it is more likely that the right thing is copy/pasted into other acceptance tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

databricks auth login doesn't respect BROWSER env var

4 participants

Comments