Skip to content

Consolidate installer pre-flight checks in preflight.sh#211

Open
mh-avant wants to merge 1 commit into
databricks-solutions:mainfrom
mh-avant:fix/installer-cli-version-check
Open

Consolidate installer pre-flight checks in preflight.sh#211
mh-avant wants to merge 1 commit into
databricks-solutions:mainfrom
mh-avant:fix/installer-cli-version-check

Conversation

@mh-avant

Copy link
Copy Markdown

Summary

  • scripts/preflight.sh is now the single source of truth for shared shell helpers (color vars, _info/_ok/_warn/_error/_header) and the tool-prerequisite check. install.sh sources them instead of redefining them.
  • _preflight_check_tools is rewritten as collect-all: it gathers every missing tool and every version issue (Databricks CLI minimum 0.297.2, Node.js engine support) and reports them together before exiting once — no more fix-one-tool-rerun loops.
  • When databricks --version cannot be parsed, the function now yellow-warns instead of green-checking, so the output doesn't misrepresent "we don't know" as "good."
  • install.sh Step 1 collapses from ~55 lines of bespoke per-tool checks to a single _preflight_check_tools call. deploy.sh is unchanged and inherits the new behavior automatically.

Why

The two scripts had near-duplicate tool-presence/version checks with different output styling and slightly different logic. The previous behavior exited on the first missing tool, which is poor UX. Deploy-time checks remain important because deploy.sh runs many times (--update mode) after the one-time install.sh — tools, network, and auth state can change between runs.

Test plan

  • bash -n scripts/install.sh scripts/preflight.sh scripts/deploy.sh passes
  • bash -c 'source scripts/preflight.sh && _preflight_check_tools' reports all five tools correctly with colored output
  • No stale references to removed vars/funcs (MISSING, DB_VERSION, NODE_VERSION, PY_VERSION, _check_databricks_cli_version)
  • Codex peer review — caught and addressed the green-✓-on-unparseable-version false positive
  • Run ./scripts/install.sh end-to-end against a real workspace (reviewer)
  • Run ./scripts/deploy.sh --update against an existing app (reviewer)

🤖 Generated with Claude Code

Move shared color vars, status helpers, and the tool-prerequisite check
into preflight.sh so install.sh and deploy.sh share one implementation.
Rewrite _preflight_check_tools as collect-all (gather every missing
tool and version issue, report them together, exit once) instead of
failing on the first miss. Yellow-warn rather than green-check when
the Databricks CLI version cannot be parsed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ryanbates99 ryanbates99 self-assigned this May 22, 2026
@ryanbates99

Copy link
Copy Markdown
Collaborator

@mh-avant I know you're a first time contributor, but wanted to find some time to chat with you about this PR

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.

2 participants