Add databricks version --check to check for available CLI updates#5469
Conversation
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
Co-authored-by: Isaac
|
Commit: bd82457
22 interesting tests: 15 SKIP, 7 KNOWN
Top 28 slowest tests (at least 2 minutes):
|
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
databricks version --check to check for available CLI updatesdatabricks version
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
databricks versiondatabricks version --check to check for available CLI updates
| @@ -0,0 +1,3 @@ | |||
| # The update check is not bundle-aware; run it once instead of per-engine. | |||
| [EnvMatrix] | |||
| DATABRICKS_BUNDLE_ENGINE = [] | |||
There was a problem hiding this comment.
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.
## 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)).
Why
databricks version(anddatabricks --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 versionprints the current version and nothing else.Now:
databricks version --checkfetches the latest release from GitHub, compares it with the running build, and prints the upgrade command for your install method:Per review feedback this is the only way to run the check (the
version checksubcommand from an earlier revision is gone). Baredatabricks versionanddatabricks --versionstay lightweight and identical to today: no network call, no output change.Details:
libs/versioncheckpackage fetchesapi.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).databricks version --check --output jsonreturns the structured result (includingcheck_failed) for scripting.First PR in a two-PR stack; the follow-up (#5470) adds a passive once-per-day notice.
Test plan
acceptance/cmd/version) covering lightweightversion,version --check, andversion --check --output json.go test ./acceptance), including thehelpoutput test../task fmt, lint on changed packages, and./task checksclean.This pull request and its description were written by Isaac.