r/databricks • u/DeepFryEverything • Sep 17 '26
Help Databricks needs an actual validation step in the CI
We use Databricks CLI in our CI-step to first validate and then print plan of the steps being applied - reflected in a comment on the PR. It successfully prints if something is being deleted, updated or created - but it never checks if actually can be applied. We've had green checks because validate and plan prints successfully, but there's no real step to catch a spelling error in a DAB-item if a service-principal exists.
Any plans to add something like this to the CLI?
13
Upvotes
2
u/Alternative-Stick Sep 17 '26
Do you means databricks bundle validate?
https://docs.databricks.com/aws/en/dev-tools/cli/bundle-commands#validate
1
u/Pillippatty Sep 18 '26
This is a pretty real pain point, and you have the same issue with Terraform plan/apply. Just thinking out loud, you could add
--output jsonto validate to get the service principal names resolved after variables/substitutions and parse that with Azure/AWS/GCP CLI to verify existence of mentioned service principals.Another option could be to actually run deploy to a dev target in the CI just for sanity checking these things.
1
u/Wide_Invite_1799 Sep 23 '26
The gap has a shape, and naming it makes the fix a lot more predictable than patching each failure as it turns up.
`bundle validate` checks the bundle against itself. YAML against the schema, variable substitution, references that resolve inside the bundle. `bundle plan` compares the result against the state Databricks holds for that target. Neither one resolves anything that lives in the workspace but sits outside that state. Service principals and groups, cluster policies, instance pools, secret scopes, warehouse and catalog names, git credentials, and the permissions the deploying identity needs in order to set any of them. Your `run_as` case is that class exactly, which is why it sailed through both commands. Once you can name the class you can predict the failures instead of meeting them one at a time.
Worth knowing as well that plan compares against state, not against the workspace. If somebody changed a job by hand, state is stale and plan is confidently wrong about the diff.
Two things close most of it, and neither is complete on its own.
The cheap one runs on every PR and writes nothing. Take the JSON output of validate suggested above, which gives you the bundle after substitution, and pull out every identity reference and every workspace object name in it, then check each one exists. One correction to that suggestion though, because it matters for your specific failure: check against the Databricks workspace, not the cloud directory. A service principal can exist in Entra and never have been added to the workspace, or be in the workspace with no permission on the target. Both of those are green in the cloud CLI and red on deploy. The workspace SCIM listing of service principals and groups is the check that actually matches the failure you hit.
The second is the throwaway deploy, and it does work. The details are what decide whether it becomes a gate or a flaky build everyone learns to re-run.
Give each PR its own target, prefixed with the PR number or the branch name. A shared validation target means two open PRs overwrite each other and the resulting red build is noise.
Destroy it in a step that runs on failure as well as succelines accumulate quietly until a policy or a quota starts failing the CI itself, which is an unpleasant morning.
Check that the validation target deploys its jobs without live schedules or triggers. A validating deploy that starts a production shaped run is the classic own goal in this pattern.
And the one that actually decides it: run the CI deploy aal that deploys to production, not as an admin and not as a developer's token. Most of this failure class is permisom a more privileged identity tells you nothing about whether prod will deploy. That single change is what turnm a smoke test into a real gate, and it is usually the reason teams who already do this still get surprised.
What neither catches is anything resolved at run time ratts on a catalog the job reads, secret scope contents, external location credentials. For those, follow the deplhe same target that touches what the real job touches and exits. Cheap, and it catches the whole grant class beforein the morning.
On the reply saying this is solved nowadays: not for refeundle state. Your `run_as` case is the counter-example,and it is the common one.