environments: don't fail setup-local on a malformed databricks.yml - #6203
Open
rugpanov wants to merge 1 commit into
Open
environments: don't fail setup-local on a malformed databricks.yml#6203rugpanov wants to merge 1 commit into
rugpanov wants to merge 1 commit into
Conversation
setup-local loads the bundle on every invocation via the shared PreRunE (root.MustWorkspaceClient), so a broken databricks.yml (e.g. two targets marked default) surfaced a bundle-config error and aborted the command before it ran — even when an explicit compute-target flag was passed. The bundle is only ever consulted as an optional source of bundle.cluster_id. Skip bundle-based auth configuration in the PreRunE (via root.SkipLoadBundle, matching cmd/sync) so a broken bundle can't fail the command up front, and load the bundle for the cluster_id fallback in an isolated, buffered logdiag context so any load error is debug-logged and treated as "no bundle target". The pipeline then falls through to E_NO_TARGET, which asks the user for an explicit --cluster-id/--cluster-name/--serverless-version/--job-task. Valid bundles with a cluster_id still resolve. Adds an acceptance test (localenv/bundle-multiple-defaults) covering the two-default case. Co-authored-by: Isaac
Contributor
Approval status: pending
|
Collaborator
Integration test reportCommit: 4b11a08
9 interesting tests: 4 SKIP, 3 RECOVERED, 1 KNOWN, 1 FAIL
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
databricks environments setup-localloads the bundle on every invocation via the shared PreRunE (root.MustWorkspaceClient). A malformeddatabricks.yml— e.g. two targets both markeddefault— therefore surfaces a bundle-config error and aborts the command before it does any of its own work, even though the bundle is only ever consulted as an optional source ofbundle.cluster_id.This also blocked explicit compute flags (
--serverless-version 5 --dry-runfailed the same way); only--target dev, which resolves the ambiguity, worked.Root cause
The bundle load runs the
SelectDefaultTargetmutator, which errors on two default targets. The error is logged vialogdiagon the shared command context during PreRunE, andMustWorkspaceClientreturnsErrAlreadyPrinted— killing the command beforerunPipeline.Fix
PreRunE wraps
MustWorkspaceClientwithroot.SkipLoadBundle(the same patterncmd/syncuses), so a broken bundle can't fail auth setup up front. Auth still resolves from profile/env.bundleTarget(thecluster_idfallback) loads the bundle in an isolated, bufferedlogdiagcontext. Any load error is debug-logged and treated as "no bundle target", so the pipeline falls through to its existingE_NO_TARGET:Valid bundles with a
cluster_idstill resolve as before.Tests
acceptance/localenv/bundle-multiple-defaults(two-defaultdatabricks.yml→ reachesE_NO_TARGET, no bundle-error leak).E_NO_TARGET;--serverless-version 5 --dry-run→ works;--debugpreserves the bundle error as a debug line; validcluster_idfallback still resolves.Found during the M5 bug bash (DECO-27936).
This pull request and its description were written by Isaac.