Skip to content

Add databricks version --check to check for available CLI updates#5469

Merged
simonfaltum merged 10 commits into
mainfrom
simonfaltum/version-update-check
Jun 10, 2026
Merged

Add databricks version --check to check for available CLI updates#5469
simonfaltum merged 10 commits into
mainfrom
simonfaltum/version-update-check

Conversation

@simonfaltum

@simonfaltum simonfaltum commented Jun 8, 2026

Copy link
Copy Markdown
Member

Why

databricks version (and databricks --version) only prints the version you're on. There's no way to tell whether you're behind, and even once you know, the command to upgrade depends on how you installed the CLI (Homebrew, WinGet, Chocolatey, or the install script). A version check also shouldn't be fragile: if GitHub is slow or unreachable it must not hang or fail the command.

Changes

Before: databricks version prints the current version and nothing else.

Now: databricks version --check fetches the latest release from GitHub, compares it with the running build, and prints the upgrade command for your install method:

Databricks CLI v0.240.0
A new version is available: 0.245.0
To upgrade, run:
  brew upgrade databricks

Per review feedback this is the only way to run the check (the version check subcommand from an earlier revision is gone). Bare databricks version and databricks --version stay lightweight and identical to today: no network call, no output change.

Details:

  • New libs/versioncheck package fetches api.github.com/repos/databricks/cli/releases/latest, semver-compares, and infers the install method from the executable path (resolving symlinks so a Homebrew shim classifies as Homebrew, not the install script).
  • The lookup is capped at 2s. If GitHub is unreachable, times out, or rate-limits, the check fails gently: it prints that it couldn't reach GitHub and links to the releases page, and still exits 0 instead of erroring.
  • Development and snapshot builds short-circuit without a network call.
  • databricks version --check --output json returns the structured result (including check_failed) for scripting.

First PR in a two-PR stack; the follow-up (#5470) adds a passive once-per-day notice.

Test plan

  • Unit tests: install-method detection across OSes, semver comparison, and the full check against a mock server (update available, up to date, dev build, server error fails gently, unreachable fails gently).
  • White-box render tests asserting exact output for all states, including the "couldn't reach GitHub" message.
  • Acceptance test (acceptance/cmd/version) covering lightweight version, version --check, and version --check --output json.
  • Full local acceptance suite (go test ./acceptance), including the help output test.
  • ./task fmt, lint on changed packages, and ./task checks clean.

This pull request and its description were written by Isaac.

The version command only printed the current version, with no way to tell whether a newer one was available. This adds an update check that fetches the latest release from GitHub, compares it to the running build, and prints the upgrade command for the detected install method (Homebrew, WinGet, Chocolatey, or the install script).

Exposed as both `databricks version --check` and a `databricks version check` subcommand. Development builds skip the check, and `--output json` is supported for scripting.

Co-authored-by: Isaac
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Commit: bd82457

Run: 27225295719

Env 🟨​KNOWN 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 7 15 261 929 8:25
🟨​ aws windows 7 15 263 927 14:25
💚​ aws-ucws linux 7 15 357 843 7:41
💚​ aws-ucws windows 7 15 359 841 13:58
💚​ azure linux 1 17 264 927 7:02
💚​ azure windows 1 17 266 925 10:54
💚​ azure-ucws linux 1 17 362 839 7:33
💚​ azure-ucws windows 1 17 364 837 12:08
💚​ gcp linux 1 17 260 930 8:25
💚​ gcp windows 1 17 262 928 13:48
22 interesting tests: 15 SKIP, 7 KNOWN
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/replace_existing 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/update_protected 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_projects/update_display_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/synced_database_tables/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/grants/select 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
Top 28 slowest tests (at least 2 minutes):
duration env testname
6:15 gcp windows TestAccept
5:52 azure-ucws windows TestAccept
5:46 azure windows TestAccept
5:16 aws-ucws windows TestAccept
5:15 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
5:06 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
4:53 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
4:25 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:59 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:28 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:14 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:11 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:11 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:09 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:03 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:02 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:59 azure linux TestAccept
2:58 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:57 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:52 gcp linux TestAccept
2:51 aws-ucws linux TestAccept
2:49 azure-ucws linux TestAccept
2:49 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:45 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:33 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:32 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:24 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:21 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct

Cap the release lookup at 2s and, when GitHub is unreachable, times out, or rate-limits, report it gently instead of failing the command: `version --check` now prints that it couldn't reach GitHub and links to the releases page to check manually, and still exits 0.

Co-authored-by: Isaac
…pdate-check

# Conflicts:
#	NEXT_CHANGELOG.md
The comment already cited GitHub's recommendation to pin the API version
but no X-GitHub-Api-Version header was actually sent.

Co-authored-by: Isaac
# The acceptance binary is a development build, so the check short-circuits
# without contacting GitHub. This exercises command wiring and output rendering.
title "version --check\n"
trace $CLI version --check

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I did not know we have both --version and version.

Is it necessary to have all these permutations? (version check / version --check / --version --check).

Perhaps we can repurpose "version" (the command) to also do the check? Then --version remains lightweight and version is more functional.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Update: settled on a middle ground. Bare version stays lightweight and identical to --version (no network call), and the check runs only via version --check. The check subcommand is gone, so there is exactly one way to invoke it.

Review feedback: version check / version --check / --version --check was
too many permutations. Instead, `databricks version` now performs the
check directly. The --version flag (cobra built-in) stays lightweight,
and `version --output json` keeps the build-info shape and skips the
network lookup so scripts are unaffected.

Also drop the always-nil error return from versioncheck.Check; lookup
failures are reported via Result.CheckFailed.

Co-authored-by: Isaac
@simonfaltum simonfaltum changed the title Add databricks version --check to check for available CLI updates Check for available CLI updates in databricks version Jun 10, 2026
Settled middle ground: `databricks version` matches `databricks
--version` exactly (no network call, no output change, original help
text restored, which also fixes the help acceptance test). The update
check runs only via `version --check`; the `check` subcommand stays
removed so there is a single way to invoke it.

Co-authored-by: Isaac
@simonfaltum simonfaltum changed the title Check for available CLI updates in databricks version Add databricks version --check to check for available CLI updates Jun 10, 2026
@simonfaltum simonfaltum requested a review from denik June 10, 2026 11:58
@@ -0,0 +1,3 @@
# The update check is not bundle-aware; run it once instead of per-engine.
[EnvMatrix]
DATABRICKS_BUNDLE_ENGINE = []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've been using [] as well but now realize that it is better to keep ["direct"] to avoid running these both in terraform and direct variant on CI.

@simonfaltum simonfaltum enabled auto-merge June 10, 2026 12:12
@simonfaltum simonfaltum disabled auto-merge June 10, 2026 12:31
@simonfaltum simonfaltum merged commit 9eb7725 into main Jun 10, 2026
6 checks passed
@simonfaltum simonfaltum deleted the simonfaltum/version-update-check branch June 10, 2026 12:31
deco-sdk-tagging Bot added a commit that referenced this pull request Jun 10, 2026
## Release v1.3.0

### Notable Changes
* The `direct` deployment engine is now Generally Available and the default for new deployments. To opt out, set `engine: terraform` under `bundle` in your `databricks.yml` or set `DATABRICKS_BUNDLE_ENGINE=terraform`. Existing deployments keep their current engine; see https://docs.databricks.com/aws/en/dev-tools/bundles/direct to migrate.

### CLI
* Added the `databricks quickstart` command, a short introduction to the CLI that prints a human-friendly guide interactively and an agent-oriented version when run non-interactively ([#5464](#5464)).
* Add `databricks version --check` to report whether a newer CLI version is available and print the upgrade command for the detected install method ([#5469](#5469)).
* `databricks auth describe` now verifies credentials against both the workspace and account endpoints before reporting a failure, fixing false "Unable to authenticate" errors for account console profiles ([#5479](#5479)).
* `databricks auth login` no longer prompts for workspace selection when logging in to an account console host (`https://accounts.*`). Pass `--workspace-id` explicitly to store a workspace ID on such a profile ([#5504](#5504)).
* `databricks auth profiles --skip-validate` no longer makes any network calls; the host metadata fetch is skipped along with validation ([#5530](#5530)).

### Bundles
* Set the default `data_security_mode` to `DATA_SECURITY_MODE_AUTO` in bundle templates ([#5452](#5452)).
* Mark vector search index index_subtype as backend_default to prevent drift after deployment ([#5454](#5454)).
* `bundle deployment migrate`: handle resources added to or removed from `databricks.yml` since the last Terraform deploy ([#5463](#5463)).
* Add the `genie_spaces` bundle resource for managing Databricks Genie spaces as code, plus `bundle generate genie-space` to import an existing space. Direct deployment engine only ([#5282](#5282)).
* Fix spurious recreate of schemas and volumes whose names use mixed case ([#5531](#5531)).
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.

3 participants